feat(Collector): better types for events (#6058)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
Jan
2021-07-05 23:26:15 +02:00
committed by GitHub
parent 4c0426c469
commit c0a814fdb3
2 changed files with 16 additions and 2 deletions

4
typings/index.d.ts vendored
View File

@@ -391,10 +391,10 @@ export abstract class Collector<K, V, F extends unknown[] = []> extends EventEmi
public abstract collect(...args: unknown[]): K | null | Promise<K | null>;
public abstract dispose(...args: unknown[]): K | null;
public on(event: 'collect' | 'dispose', listener: (...args: unknown[]) => Awaited<void>): this;
public on(event: 'collect' | 'dispose', listener: (...args: [V, ...F]) => Awaited<void>): this;
public on(event: 'end', listener: (collected: Collection<K, V>, reason: string) => Awaited<void>): this;
public once(event: 'collect' | 'dispose', listener: (...args: unknown[]) => Awaited<void>): this;
public once(event: 'collect' | 'dispose', listener: (...args: [V, ...F]) => Awaited<void>): this;
public once(event: 'end', listener: (collected: Collection<K, V>, reason: string) => Awaited<void>): this;
}