-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removeAllListeners should allow no arguments #29
Comments
Hi @apowers313 I will gladly update the Line 24 in dcf73c6
to removeAllListeners(type?: string | symbol): Promise<any>; resolve the issue, or is there anything else? |
Since the type definition seems to also be missing a few properties, would this be a suitable update (again, I'm not using TypeScript, so I'm mostly flying blind on this issue) : import type events from 'events';
type BaseEventEmitter = Omit<events.EventEmitter, 'emit'|'once'|'on'|'off'|'prependOnceListener'|'prependListener'|'addListener'|'removeListener'|'removeAllListeners'>;
declare type TEventType = string | symbol;
declare type TListener = (...args: any[]) => Promise<any>;
declare type TFilter<T = any> = {
<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];
(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
}
interface EventEmitter extends BaseEventEmitter {}
declare class EventEmitter implements EventEmitter {
private _resultFilter;
private _events;
private _eventsCount;
private _domain;
get maxListeners(): number;
set maxListeners(n: number);
getResultFilter(): TFilter | undefined;
setResultFilter(filter: TFilter | undefined): this;
get resultFilter(): TFilter | undefined;
set resultFilter(filter: TFilter | undefined);
emit(type: TEventType, ...args: any[]): Promise<any>;
addListener(type: TEventType, listener: TListener): Promise<any>;
prependListener(type: TEventType, listener: TListener): Promise<any>;
once(type: TEventType, listener?: TListener): Promise<any>;
prependOnceListener(type: TEventType, listener: TListener): Promise<any>;
removeListener(type: TEventType, listener: TListener): Promise<any>;
removeAllListeners(type?: string | symbol): Promise<any>;
on(type: TEventType, listener: TListener): Promise<any>;
off(type: TEventType, listener: TListener): Promise<any>;
static EventEmitter: typeof EventEmitter;
static defaultMaxListeners: number | undefined;
static usingDomains: boolean | undefined;
static listenerCount: (events: EventEmitter, type: TEventType) => number;
}
export = EventEmitter; |
Currently 'removeAllListeners' is defined as
removeAllListeners(type: string | symbol): Promise<any>
, requiring astring
orsymbol
argument. Per the node documentation, the argument is optional and if no argument is specified all listeners are removed.The text was updated successfully, but these errors were encountered: