Skip to content

Commit

Permalink
fix: dont require index signature in event map typing
Browse files Browse the repository at this point in the history
Without this change, the following error appears when using an interface
of event listeners:

Type 'MyEventListeners' does not satisfy the constraint 'ValidEventTypes'.
  Type 'MyEventListeners' is not assignable to type '{ [x: string]: any[] | ((...args: any[]) => void); }'.
    Index signature is missing in type 'NodeRunnerEventListeners<Output>
  • Loading branch information
forivall committed Aug 21, 2020
1 parent aa8d192 commit e71f3b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ declare namespace EventEmitter {
export type ValidEventTypes =
| string
| symbol
| { [K in string | symbol]: any[] | ((...args: any[]) => void) };
| { [K in string | symbol]: any[] | ((...args: any[]) => void) | undefined };

export type EventNames<T extends ValidEventTypes> = T extends string | symbol
? T
Expand Down

0 comments on commit e71f3b0

Please sign in to comment.