diff --git a/src/runtime/internal/lifecycle.ts b/src/runtime/internal/lifecycle.ts index 34d52672a29b..304e8d6a680f 100644 --- a/src/runtime/internal/lifecycle.ts +++ b/src/runtime/internal/lifecycle.ts @@ -27,7 +27,9 @@ export function onDestroy(fn) { get_current_component().$$.on_destroy.push(fn); } -export function createEventDispatcher() { +export function createEventDispatcher< + EventMap extends {} = any +>(): >(type: EventKey, detail?: EventMap[EventKey]) => void { const component = get_current_component(); return (type: string, detail?: any) => { @@ -61,4 +63,4 @@ export function bubble(component, event) { if (callbacks) { callbacks.slice().forEach(fn => fn(event)); } -} \ No newline at end of file +}