diff options
| author | Zach Buttram <[email protected]> | 2018-09-19 05:37:03 -0700 |
|---|---|---|
| committer | Jason Miller <[email protected]> | 2018-09-19 08:37:03 -0400 |
| commit | d08d7821efb479967b7f65bcf43f3187eb97eacf (patch) | |
| tree | 6b393ac8582715aec7bd8c3d2d120a147682c9d5 | |
| parent | 0f4e8f0d3c0cfe4581edd9e93d3dac0ce994eefb (diff) | |
Fix Typescript wildcard handler (#76)
* attempt to fix handler typedef for wildcard events
* also fix wildcard handler typedef for .off
| -rw-r--r-- | mitt.d.ts | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -6,6 +6,7 @@ declare module "mitt" { declare namespace mitt { type Handler = (event?: any) => void; + type WildcardHandler = (type?: string, event?: any) => void; interface MittStatic { (all?: {[key: string]: Handler}): Emitter; @@ -21,6 +22,7 @@ declare namespace mitt { * @memberOf Mitt */ on(type: string, handler: Handler): void; + on(type: "*", handler: WildcardHandler): void; /** * Function to call in response to the given event @@ -31,6 +33,7 @@ declare namespace mitt { * @memberOf Mitt */ off(type: string, handler: Handler): void; + off(type: "*", handler: WildcardHandler): void; /** * Invoke all handlers for the given type. |
