Started getting error TS2339: Property '<prop>' does not exist on type 'EventTarget'
errors from code that tries to access event.target.<prop>
where event is of type React.FormEvent<any>
after upgrading TypeScript 2.0.3.0 to 2.0.6.0 in Visual Studio.
Apparently, the SyntheticEvent
In many cases, the target and currentTarget properties are interchangeable (event handler is attached directly to the control emitting the event, see here for an explanation of the properties). Otherwise, you can get rid of the error message by either using the square bracket notation or by casting to the correct type:
event.currentTarget.prop
event.target["prop"]
(<HTMLInputElement>event.target).prop
((event.target as HTMLInputElement).prop
syntax is required in tsx (TypeScript-JSX) code if doing React).