We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6ebe7f8 commit aa7e5e3Copy full SHA for aa7e5e3
src/runtime/internal/lifecycle.ts
@@ -27,7 +27,9 @@ export function onDestroy(fn) {
27
get_current_component().$$.on_destroy.push(fn);
28
}
29
30
-export function createEventDispatcher() {
+export function createEventDispatcher<
31
+ EventMap extends {} = any
32
+>(): <EventKey extends Extract<keyof EventMap, string>>(type: EventKey, detail?: EventMap[EventKey]) => void {
33
const component = get_current_component();
34
35
return (type: string, detail?: any) => {
@@ -61,4 +63,4 @@ export function bubble(component, event) {
61
63
if (callbacks) {
62
64
callbacks.slice().forEach(fn => fn(event));
65
-}
66
+}
0 commit comments