-
-
Notifications
You must be signed in to change notification settings - Fork 48
New rule: require-event-dispatcher-types
#346
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
Comments
Oh and if you type your events, all the listeners get typechecked as well, so this really is something you want to do if you are using TS... |
Thanks for the rule suggestions. But why is the example below marked as const dispatch = createEventDispatcher<any>();
const dispatch = createEventDispatcher<{}>(); |
Hmm, originally, I though of the rule as being a reminder not to forget the types - that's why I put those examples there, I didn't really care about what the type is, just that there is one... I think As with the The rule could report for both of those - I think it probably should report for |
Thank you for your opinion.
I hear you and I agree with it. The |
Great, yeah, let's make it simple if there's no need to make the rule more complex... |
Motivation
Hi,
when using svelte with TypeScript, it is possible to add types to events by typing the
createEventDispatcher
function so:I propose a rule that would require all calls to
createEventDispatcher
to include the templated type.Description
The rule would trigger on any call of
createEventDispatcher
witchou the templated typeExamples
Additional comments
No response
The text was updated successfully, but these errors were encountered: