How to find event type in Typescript
1 answer
You probably want to just check event.typeto find out what it is and infer the type from it.
Otherwise, you can try using event instanceof KeyboardEventeither custom types of protection .
Also, in your example, you can just make an argument event:KeyboardEventinstead event:any.
+6