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 // Set the status to reconnecting
this.status = Status.Reconnecting; this.status = Status.Reconnecting;
// Finally, emit the INVALID_SESSION event // Finally, emit the INVALID_SESSION event
/**
* Emitted when the session has been invalidated.
* @event WebSocketShard#invalidSession
*/
this.emit(ShardEvents.InvalidSession); this.emit(ShardEvents.InvalidSession);
break; break;
case GatewayOpcodes.HeartbeatAck: case GatewayOpcodes.HeartbeatAck:

View File

@@ -2178,8 +2178,8 @@ export class SelectMenuInteraction<Cached extends CacheType = CacheType> extends
} }
export interface ShardEventTypes { export interface ShardEventTypes {
spawn: [child: ChildProcess]; spawn: [process: ChildProcess | Worker];
death: [child: ChildProcess]; death: [process: ChildProcess | Worker];
disconnect: []; disconnect: [];
ready: []; ready: [];
reconnecting: []; reconnecting: [];
@@ -2852,6 +2852,7 @@ export interface WebSocketShardEvents {
ready: []; ready: [];
resumed: []; resumed: [];
invalidSession: []; invalidSession: [];
destroyed: [];
close: [event: CloseEvent]; close: [event: CloseEvent];
allReady: [unavailableGuilds?: Set<Snowflake>]; 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 { import {
APIInteractionGuildMember, APIInteractionGuildMember,
APIPartialChannel, APIPartialChannel,
@@ -1470,7 +1471,7 @@ client.on('interactionCreate', async interaction => {
declare const shard: Shard; declare const shard: Shard;
shard.on('death', process => { shard.on('death', process => {
expectType<ChildProcess>(process); expectType<ChildProcess | Worker>(process);
}); });
declare const webSocketShard: WebSocketShard; declare const webSocketShard: WebSocketShard;