Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<input onClick="string()"/> throws TypeError #1656

Open
EduApps-CDG opened this issue Nov 26, 2023 · 6 comments
Open

<input onClick="string()"/> throws TypeError #1656

EduApps-CDG opened this issue Nov 26, 2023 · 6 comments

Comments

@EduApps-CDG
Copy link

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

@Havunen Havunen added the bug label Nov 27, 2023
@Havunen
Copy link
Member

Havunen commented Nov 27, 2023

Hi, thanks for reporting this issue. I will look into it.

@Havunen
Copy link
Member

Havunen commented Nov 27, 2023

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} />

@EduApps-CDG
Copy link
Author

EduApps-CDG commented Nov 27, 2023 via email

@EduApps-CDG
Copy link
Author

EduApps-CDG commented Dec 25, 2023

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

@Havunen
Copy link
Member

Havunen commented Dec 25, 2023

ah, so you want to do this in server side rendering?

@EduApps-CDG
Copy link
Author

EduApps-CDG commented Dec 27, 2023

Yup, exactly. My client side code is minified on my own way, and I don't need inferno in the client side (yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants