types: add missing shard types (#8180)

This commit is contained in:
CarelessInternet
2022-06-30 00:37:55 +02:00
committed by GitHub
parent 11b1739319
commit 27d8deb471
3 changed files with 10 additions and 4 deletions

View File

@@ -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:

View File

@@ -2178,8 +2178,8 @@ export class SelectMenuInteraction<Cached extends CacheType = CacheType> 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<Snowflake>];
}

View File

@@ -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<ChildProcess>(process);
expectType<ChildProcess | Worker>(process);
});
declare const webSocketShard: WebSocketShard;