mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
types: make event emitters use mapped event types (#7019)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { ChildProcess } from 'child_process';
|
||||
import type {
|
||||
APIGuildMember,
|
||||
APIInteractionGuildMember,
|
||||
@@ -26,6 +27,7 @@ import {
|
||||
Client,
|
||||
ClientApplication,
|
||||
ClientUser,
|
||||
CloseEvent,
|
||||
Collection,
|
||||
CommandInteraction,
|
||||
CommandInteractionOption,
|
||||
@@ -81,6 +83,8 @@ import {
|
||||
Shard,
|
||||
ApplicationCommandAutocompleteOption,
|
||||
ApplicationCommandNumericOptionData,
|
||||
WebSocketShard,
|
||||
Collector,
|
||||
} from '.';
|
||||
import type { ApplicationCommandOptionTypes } from './enums';
|
||||
|
||||
@@ -1124,4 +1128,31 @@ client.on('interactionCreate', async interaction => {
|
||||
|
||||
declare const shard: Shard;
|
||||
|
||||
shard.on('death', process => {
|
||||
assertType<ChildProcess>(process);
|
||||
});
|
||||
|
||||
declare const webSocketShard: WebSocketShard;
|
||||
|
||||
webSocketShard.on('close', event => {
|
||||
assertType<CloseEvent>(event);
|
||||
});
|
||||
|
||||
declare const collector: Collector<string, Interaction, string[]>;
|
||||
|
||||
collector.on('collect', (collected, ...other) => {
|
||||
assertType<Interaction>(collected);
|
||||
assertType<string[]>(other);
|
||||
});
|
||||
|
||||
collector.on('dispose', (vals, ...other) => {
|
||||
assertType<Interaction>(vals);
|
||||
assertType<string[]>(other);
|
||||
});
|
||||
|
||||
collector.on('end', (collection, reason) => {
|
||||
assertType<Collection<string, Interaction>>(collection);
|
||||
assertType<string>(reason);
|
||||
});
|
||||
|
||||
assertType<Promise<number | null>>(shard.eval(c => c.readyTimestamp));
|
||||
|
||||
Reference in New Issue
Block a user