/// declare class AsyncEventEmitter = Record & AsyncEventEmitterPredefinedEvents> { private _events; private _eventCount; private _maxListeners; private _internalPromiseMap; private _wrapperId; addListener(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; on(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; once(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; removeListener(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; off(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; removeAllListeners(event?: K | undefined): this; setMaxListeners(n: number): this; getMaxListeners(): number; listeners(eventName: K): Listener['listener'][]; rawListeners(eventName: K): Listener[]; emit(eventName: K, ...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]): boolean; listenerCount(eventName: K): number; prependListener(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; prependOnceListener(eventName: K, listener: (...args: K extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[K] : Events[K]) => void): this; eventNames(): (keyof Events | keyof AsyncEventEmitterPredefinedEvents)[]; waitForAllListenersToComplete(): Promise; private _addListener; private _wrapListener; static listenerCount, EventNames = Emitter extends AsyncEventEmitter ? Events : never, EventName extends PropertyKey = EventNames extends never ? string | symbol : keyof EventNames>(emitter: Emitter, eventName: EventName | keyof AsyncEventEmitterPredefinedEvents): number; static once, EventNames extends Record = Emitter extends AsyncEventEmitter ? Events : Record, EventName extends PropertyKey = keyof EventNames | keyof AsyncEventEmitterPredefinedEvents, EventResult extends unknown[] = EventName extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[EventName] : EventNames[EventName]>(emitter: Emitter, eventName: EventName, options?: AbortableMethods): Promise; static on, EventNames extends Record = Emitter extends AsyncEventEmitter ? Events : Record, EventName extends PropertyKey = keyof EventNames | keyof AsyncEventEmitterPredefinedEvents, EventResult extends unknown[] = EventName extends keyof AsyncEventEmitterPredefinedEvents ? AsyncEventEmitterPredefinedEvents[EventName] : EventNames[EventName]>(emitter: Emitter, eventName: EventName, options?: AbortableMethods): AsyncGenerator; } interface AsyncEventEmitterPredefinedEvents { newListener: [eventName: string | symbol, listener: (...args: any[]) => Awaitable]; removeListener: [eventName: string | symbol, listener: (...args: any[]) => Awaitable]; } interface WrappedOnce { (...args: Args): Awaitable; listener: (...args: Args) => Awaitable; _hasWarnedAboutMaxListeners?: boolean; } interface Listener { (...args: Args): Awaitable; listener: (...args: Args) => Awaitable; _hasWarnedAboutMaxListeners?: boolean; } type Awaitable = T | Promise; interface AbortableMethods { signal?: AbortSignal; } interface AbortErrorOptions { cause?: unknown; } declare class AbortError extends Error { readonly code = "ABORT_ERR"; readonly name = "AbortError"; constructor(message?: string, options?: AbortErrorOptions | undefined); } export { AbortError, AbortErrorOptions, AbortableMethods, AsyncEventEmitter, AsyncEventEmitterPredefinedEvents, Awaitable, Listener, WrappedOnce };