Skip to content

Commit

Permalink
types: add missing shard types (v13) (#8192)
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Jun 29, 2022
1 parent 125696f commit 079973f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/client/websocket/WebSocketShard.js
Expand Up @@ -466,6 +466,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.INVALID_SESSION);
break;
case Opcodes.HEARTBEAT_ACK:
Expand Down
5 changes: 3 additions & 2 deletions typings/index.d.ts
Expand Up @@ -2131,8 +2131,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: [];
Expand Down Expand Up @@ -2783,6 +2783,7 @@ export interface WebSocketShardEvents {
ready: [];
resumed: [];
invalidSession: [];
destroyed: [];
close: [event: CloseEvent];
allReady: [unavailableGuilds?: Set<Snowflake>];
}
Expand Down
3 changes: 2 additions & 1 deletion typings/index.test-d.ts
@@ -1,4 +1,5 @@
import type { ChildProcess } from 'child_process';
import type { Worker } from 'worker_threads';
import type {
APIInteractionGuildMember,
APIMessage,
Expand Down Expand Up @@ -1191,7 +1192,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;
Expand Down

0 comments on commit 079973f

Please sign in to comment.