I\'m trying to get rid of my tslint error Type declaration of \'any\' loses type-safety. but I\'m struggling to figure out what the correct type would be for the Ev
As posted in my update above, a potential solution would be to use Declaration Merging as suggested by @Tyler-sebastion. I was able to define two additional interfaces and add the index property on the EventTarget in this way.
interface KonvaTextEventTarget extends EventTarget {
index: number
}
interface KonvaMouseEvent extends React.MouseEvent {
target: KonvaTextEventTarget
}
I then can declare the event as KonvaMouseEvent in my onclick MouseEventHandler function.
onClick={(event: KonvaMouseEvent) => {
makeMove(ownMark, event.target.index)
}}
I'm still not 100% if this is the best approach as it feels a bit Kludgy and overly verbose just to get past the tslint error.