-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve typings of event emitters for Transport, Producer, Consumer, …
…DataProducer, DataConsumer
- Loading branch information
Showing
21 changed files
with
312 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
export declare class EnhancedEventEmitter extends EventEmitter { | ||
declare type Events = Record<string, any[]>; | ||
declare type InternalEvents = Record<`@${string}`, any[]>; | ||
export declare class EnhancedEventEmitter<PublicEvents extends Events = Events, E extends PublicEvents = PublicEvents & InternalEvents> extends EventEmitter { | ||
constructor(); | ||
safeEmit(event: string, ...args: any[]): boolean; | ||
safeEmitAsPromise(event: string, ...args: any[]): Promise<any>; | ||
safeEmit<K extends keyof E & string>(event: K, ...args: E[K]): boolean; | ||
safeEmitAsPromise<K extends keyof E & string>(event: K, ...args: [ | ||
] extends E[K] ? unknown[] : [E[K][0]]): Promise<any>; | ||
on<K extends keyof E & string>(event: K, listener: (...args: E[K]) => void): this; | ||
off<K extends keyof E & string>(event: K, listener: (...args: E[K]) => void): this; | ||
addListener<K extends keyof E & string>(event: K, listener: (...args: E[K]) => void): this; | ||
prependListener<K extends keyof E & string>(event: K, listener: (...args: E[K]) => void): this; | ||
once<K extends keyof E & string>(event: K, listener: (...args: E[K]) => void): this; | ||
prependOnceListener<K extends keyof E & string>(event: K, listener: (...args: E[K]) => void): this; | ||
removeListener<K extends keyof E & string>(event: K, listener: (...args: E[K]) => void): this; | ||
} | ||
export {}; | ||
//# sourceMappingURL=EnhancedEventEmitter.d.ts.map |
Oops, something went wrong.