-
-
Notifications
You must be signed in to change notification settings - Fork 209
(feat) (svelte2tsx) Type check event forward from element on component #303
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
Conversation
…nto event-type-check
Can't get it to extract event type from |
1. $on return off funciton 2. wildcard event is CustomEvent now
…nto event-type-check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! There is one problem that remains: When the user defines a custom event, it will not get picked up and it will throw a false type error:
<script>
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
dispatch('hello', 3);
</script>
<script>
import Child from './Child.svelte';
</script>
<Child on:hello={e => e} /> // <--- throws an error
We somehow need to fall back to the generic Event
interface in this case.
19eae2c
to
1de7315
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Aims to be able to type-check events bubbled/forwarded from an element. https://svelte.dev/docs#on_element_event
Part of #304
Component.svelte
Component2.svelte