* 'new EventEmitter() as TypedEventEmitter<{ submit: [...args] }>'main
parent
0c7c1591ad
commit
558ec9ef67
1 changed files with 21 additions and 0 deletions
@ -0,0 +1,21 @@ |
|||||||
|
declare interface TypedEventEmitter< |
||||||
|
MapToEventListenerParameters extends Record<string | symbol, unknown[]>, |
||||||
|
EventName = keyof MapToEventListenerParameters, |
||||||
|
> extends import('events').EventEmitter { |
||||||
|
emit( |
||||||
|
event: EventName, |
||||||
|
...args: MapToEventListenerParameters[EventName] |
||||||
|
): boolean; |
||||||
|
|
||||||
|
listenerCount(event: EventName): number; |
||||||
|
|
||||||
|
on( |
||||||
|
event: EventName, |
||||||
|
listener: (...args: MapToEventListenerParameters[EventName]) => void, |
||||||
|
): this; |
||||||
|
|
||||||
|
once( |
||||||
|
event: EventName, |
||||||
|
listener: (...args: MapToEventListenerParameters[EventName]) => void, |
||||||
|
): this; |
||||||
|
} |
Loading…
Reference in new issue