Skip to content
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

types: fix events augmentation #8681

Merged
merged 2 commits into from Oct 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions packages/discord.js/typings/index.d.ts
Expand Up @@ -193,11 +193,14 @@ import {
declare module 'node:events' {
class EventEmitter {
// Add type overloads for client events.
public static once<K extends keyof ClientEvents>(eventEmitter: Client, eventName: K): Promise<ClientEvents[K]>;
public static on<K extends keyof ClientEvents>(
eventEmitter: Client,
eventName: K,
): AsyncIterableIterator<ClientEvents[K]>;
public static once<E extends EventEmitter, K extends keyof ClientEvents>(
eventEmitter: E,
eventName: E extends Client ? K : string,
): Promise<E extends Client ? ClientEvents[K] : any[]>;
public static on<E extends EventEmitter, K extends keyof ClientEvents>(
eventEmitter: E,
eventName: E extends Client ? K : string,
): AsyncIterableIterator<E extends Client ? ClientEvents[K] : any>;
}
}

Expand Down