1

I want to make my code TypeSafe but I get the error Property 'files' does not exist on type 'EventTarget'

<Input onChange={(e: FormEvent<HTMLInputElement>) => onChangeImage(e.nativeEvent?.target?.files[0])}

  • perhaps it's case sensitive, shouldn't it be `input` and `onchange` ? – vanowm Aug 12 '22 at 11:04
  • Does this answer your question? [Property 'files' does not exist on type 'EventTarget' error in typescript](https://stackoverflow.com/questions/43176560/property-files-does-not-exist-on-type-eventtarget-error-in-typescript) – Luke Storry Aug 12 '22 at 11:51

1 Answers1

0

See the related Typescript issue here for solutions / workarounds: https://github.com/microsoft/TypeScript/issues/31816

Also possible duplicate here: Property 'files' does not exist on type 'EventTarget' error in typescript

Luke Storry
  • 6,032
  • 1
  • 9
  • 22