Typescript and createEventDispatcher
#3991
|
HI there, how can I give dispatched events types? const dispatch = createEventDispatcher();
// ...
dispatch('eventName', { id: 'id123' , type: 'abc' }What's the best way of telling Typescript that for dispatched events of type Any help is appreciated. 🙏 |
Answered by
mustofa-id
Feb 18, 2022
Replies: 1 comment 2 replies
|
Sound more Svelte than Kit. |
2 replies
Answer selected by
b2m9
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sound more Svelte than Kit.
You can type event name and detail like so:
createEventDispatcher<{eventName: { id: string, type: striing }}>()