diff --git a/src/runtime/internal/Component.ts b/src/runtime/internal/Component.ts index f6fc91d497..e249b9d566 100644 --- a/src/runtime/internal/Component.ts +++ b/src/runtime/internal/Component.ts @@ -224,7 +224,7 @@ export class SvelteComponent< this.$destroy = noop; } - $on>(type: K, callback: (e: CustomEvent) => void) { + $on>(type: K, callback: (e: Events[K]) => void) { const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = [])); callbacks.push(callback); diff --git a/src/runtime/internal/dev.ts b/src/runtime/internal/dev.ts index ee32fe5778..3569a68edb 100644 --- a/src/runtime/internal/dev.ts +++ b/src/runtime/internal/dev.ts @@ -103,7 +103,7 @@ export interface SvelteComponentDev< Slots extends Record = any > { $set(props?: Partial & Record): void; - $on>(type: K, callback: (e: CustomEvent) => void): () => void; + $on>(type: K, callback: (e: Events[K]) => void): () => void; $destroy(): void; [accessor: string]: any; }