3 ms·
That second version is literally 100% verified and valid Typescript. `e` is inferred from `HTMLProps<HTMLInputElement>['onChange']` `t` is inferred from `e`
by SebastianKra 3y ago
That second version is literally 100% verified and valid Typescript.
`e` is inferred from `HTMLProps<HTMLInputElement>['onChange']`
`t` is inferred from `e`
`files` is inferred from `t`
No halfway experienced TS developer would write any of these annotations.
If you got the myImageElem from a ref, you may need to add a !, because yes, it's not technically guaranteed that the ref is set by the time the callback is called.