/** * An events map is an interface that maps event names to their value, which * represents the type of the `on` listener. */ export interface EventsMap { [event: string]: any; } /** * The default events map, used if no EventsMap is given. Using this EventsMap * is equivalent to accepting all event names, and any data. */ export interface DefaultEventsMap { [event: string]: (...args: any[]) => void; } /** * Returns a union type containing all the keys of an event map. */ export type EventNames = keyof Map & (string | symbol); /** The tuple type representing the parameters of an event listener */ export type EventParams> = Parameters; /** * Interface for classes that aren't `EventEmitter`s, but still expose a * strictly typed `emit` method. */ export interface TypedEventBroadcaster { emit>(ev: Ev, ...args: EventParams): boolean; }