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

infer custom element type in HTML code #369

Open
Kokujou opened this issue Sep 20, 2024 · 0 comments
Open

infer custom element type in HTML code #369

Kokujou opened this issue Sep 20, 2024 · 0 comments

Comments

@Kokujou
Copy link

Kokujou commented Sep 20, 2024

this is a feature i'm waiting for a very long time. assume you dispatch a CustomEvent

this.dispatchEvent(new CustomEvent("my-event", { detail: {myProperty: 'whatever'} });

and then you listen to it via HTML code, or even using an addEventListener

<my-element @my-event="${e => doStuffWith(e.detail.myProperty)}"

you will get an error. now you need to define the type of the event in 2 places and this is of course not type safe.
the thing is, when hovering over @My-event we already have the information of the event type.
if we could have this mixed in the typescript plugin, that overrides the type detection in this special scenario with the type we already have on hover, we're good.

can someone please look into that?

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

1 participant