-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
How do I type custom events for a package? #1243
Comments
I guess you talking about custom events in the context of actions. If not, the solution below doesn't apply. This came up in Discord, too, recently, here is the thread: https://discord.com/channels/457912077277855764/897113912422580274 . It didn't seem to work for that person but I didn't look into why exactly. If you could try the steps and report back if it works that would be great. The steps (roughly):
If you have your package publicly somewhere, I could take a look. I also plan on introducing support for typing the events of an action on the action function itself. So basically you would be able to hint at typescript that by applying an action to a DOM element that element now has additional attributes/events that can be passed to it. This depends on changes to Svelte core and a pending rewrite of svelte2tsx, so this will take a little while. |
I wrote this package as a test, it has a |
Yes, autocomplete intellisense is missing because that needs some more work on our side to make it show up (not sure how we can get there without showing all other redundant completions). |
Yea would be awesome to be able to do this but glad to know that this does work just missing intellisense - how would you recommend doing this with sveltekit package for example? |
I was wondering what would be the best way to type custom events for a package, puru was recently doing this and now I am too - while you can type the events like this (https://discord.com/channels/457912077277855764/728292755087818924/908761587660255313) I don't know of a way to export those types out of a package and have the language server pick up on that
Any ideas?
The text was updated successfully, but these errors were encountered: