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

FIX: '"onclick"' does not exist in type #4

Closed
ICTServ opened this issue Apr 3, 2024 · 4 comments
Closed

FIX: '"onclick"' does not exist in type #4

ICTServ opened this issue Apr 3, 2024 · 4 comments

Comments

@ICTServ
Copy link

ICTServ commented Apr 3, 2024

Please add onclick?: () => void; to the following declaration in the components that use onclick event such as Button, Avatar, Dropdown, ... etc.
declare const __propDef: { props: { onclick?: () => void; }; }

@shinokada
Copy link
Owner

Since all components have ...attributes props, you can add any events in Svelte: Runes.

I know it gives type warnings, but I hope Svelte language support adjust it in future.

What do you think?

@ICTServ
Copy link
Author

ICTServ commented Apr 4, 2024

I think better to add onclick defenition as optional parameter in the propDef, since no need to pass its value it automatically recognise onclick event and stop warning. onclick is heavily used event, instead of having warning it is better to eliminate the warning. I test it and it fix the issue. I don't see any downside of adding to declare const __propDef whether they fix it in the future or not. I happy to contribute if want to.

@shinokada
Copy link
Owner

I can add to some components, but not that simple since there are quite few A11y restrictions. I will add to some components but I will leave the rest to users.

@shinokada
Copy link
Owner

v0.4.5 is published.

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

No branches or pull requests

2 participants