<input onClick="string()"/> throws TypeError
EduApps-CDG opened this issue · comments
Observed Behaviour
the onClick
property MUST be a MouseEventHandler or undefined. Because of this behaviour, I'm unable to call my client-side functions defined in a external script.
<input type="submit" onClick="doSomething()"/> - Type 'string' is not assignable to type 'MouseEventHandler<T> | undefined'.ts(2322)
The syntax works if you insert a //@ts-ignore
.
Expected Current Behaviour
Inferno should have string-compatible types.
Inferno Metadata
Linux
Hi, thanks for reporting this issue. I will look into it.
What about referring to the method through global object? You could also extend the window type definition with external methods to have type system working.
<input type="submit" onClick={window.doSomething} />
Sorry for the late reply. As I'm not in a client-side context, the "window" word is not set. It says that window is not defined
ah, so you want to do this in server side rendering?
Yup, exactly. My client side code is minified on my own way, and I don't need inferno in the client side (yet).