diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 8119271dec5c..1c22ecc3d8be 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -955,6 +955,8 @@ export class Client extends BaseClient { private _eval(script: string): unknown; private _validateOptions(options: ClientOptions): void; private get _censoredToken(): string | null; + // This a technique used to brand the ready state. Or else we'll get `never` errors on typeguard checks. + private readonly _ready: Ready; public application: If; public channels: ChannelManager; diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index 86b28249e6b0..026e2f80794a 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -197,6 +197,12 @@ const client: Client = new Client({ }), }); +if (client.isReady()) { + expectType>(client); +} else { + expectType(client); +} + const testGuildId = '222078108977594368'; // DJS const testUserId = '987654321098765432'; // example id const globalCommandId = '123456789012345678'; // example id