Skip to content

Commit

Permalink
(fix) relax event handler typings (#1502)
Browse files Browse the repository at this point in the history
null and undefined are valid inputs
  • Loading branch information
dummdidumm committed Sep 28, 2022
1 parent 598f905 commit 74affc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/svelte2tsx/svelte-shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ declare class Svelte2TsxComponent<
* Causes the callback function to be called whenever the component dispatches an event.
* A function is returned that will remove the event listener when called.
*/
$on<K extends keyof Events & string>(event: K, handler: (e: Events[K]) => any): () => void;
$on<K extends keyof Events & string>(event: K, handler: ((e: Events[K]) => any) | null | undefined): () => void;
/**
* Removes a component from the DOM and triggers any `onDestroy` handlers.
*/
Expand Down Expand Up @@ -292,7 +292,7 @@ declare type ATypedSvelteComponent = {
*/
$$slot_def: any;

$on(event: string, handler: (e: any) => any): () => void;
$on(event: string, handler: ((e: any) => any) | null | undefined): () => void;
}
/**
* Ambient type only used for intellisense, DO NOT USE IN YOUR PROJECT
Expand Down

0 comments on commit 74affc3

Please sign in to comment.