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

Component event type check #304

Closed
jasonlyu123 opened this issue Jul 12, 2020 · 1 comment
Closed

Component event type check #304

jasonlyu123 opened this issue Jul 12, 2020 · 1 comment

Comments

@jasonlyu123
Copy link
Member

Is your feature request related to a problem? Please describe.
Current component type check can only check if it is (e: Event) => any

Describe the solution you'd like

  1. Event forward like <button on:click /> can have type check in consumer component
  2. Can type check for event dispatched by event-dispatcher

Describe alternatives you've considered
if the event dispatched by event-dispatcher can't be type-check or it is dispatched by an imported function provides a way to manually define the event's type. For example:

interface $$ComponentEventDef {
    'some-event': CustomEvent<number>
}
dummdidumm pushed a commit to dummdidumm/language-tools that referenced this issue Aug 17, 2020
This adds the possibility to use a reserved interface name `ComponentEvents` and define all possible events within it.
Also adds autocompletion for these events.
Also disables autocompletions from HTMLPlugin on component tags.

sveltejs#424 sveltejs#304
dummdidumm added a commit that referenced this issue Aug 20, 2020
This adds the possibility to use a reserved interface name `ComponentEvents` and define all possible events within it.
Also adds autocompletion for these events.
Also disables autocompletions from HTMLPlugin on component tags.
Also fixes an import type bug.

#424 #304
@dummdidumm
Copy link
Member

Closing in favor of #424

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