diff --git a/packages/discord.js/src/client/websocket/WebSocketShard.js b/packages/discord.js/src/client/websocket/WebSocketShard.js index c3490ca51..9ffbd9143 100644 --- a/packages/discord.js/src/client/websocket/WebSocketShard.js +++ b/packages/discord.js/src/client/websocket/WebSocketShard.js @@ -464,6 +464,10 @@ class WebSocketShard extends EventEmitter { // Set the status to reconnecting this.status = Status.Reconnecting; // Finally, emit the INVALID_SESSION event + /** + * Emitted when the session has been invalidated. + * @event WebSocketShard#invalidSession + */ this.emit(ShardEvents.InvalidSession); break; case GatewayOpcodes.HeartbeatAck: diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 590b4ebe6..f0a1369ec 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2178,8 +2178,8 @@ export class SelectMenuInteraction extends } export interface ShardEventTypes { - spawn: [child: ChildProcess]; - death: [child: ChildProcess]; + spawn: [process: ChildProcess | Worker]; + death: [process: ChildProcess | Worker]; disconnect: []; ready: []; reconnecting: []; @@ -2852,6 +2852,7 @@ export interface WebSocketShardEvents { ready: []; resumed: []; invalidSession: []; + destroyed: []; close: [event: CloseEvent]; allReady: [unavailableGuilds?: Set]; } diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index 7f4aa2ee7..567d41ad0 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -1,4 +1,5 @@ -import type { ChildProcess } from 'child_process'; +import type { ChildProcess } from 'node:child_process'; +import type { Worker } from 'node:worker_threads'; import { APIInteractionGuildMember, APIPartialChannel, @@ -1470,7 +1471,7 @@ client.on('interactionCreate', async interaction => { declare const shard: Shard; shard.on('death', process => { - expectType(process); + expectType(process); }); declare const webSocketShard: WebSocketShard;