mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
types(Shard): eval returns a promise resolving with T instead of T[] (#6901)
This commit is contained in:
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -1746,7 +1746,7 @@ export class Shard extends EventEmitter {
|
|||||||
public ready: boolean;
|
public ready: boolean;
|
||||||
public worker: Worker | null;
|
public worker: Worker | null;
|
||||||
public eval(script: string): Promise<unknown>;
|
public eval(script: string): Promise<unknown>;
|
||||||
public eval<T>(fn: (client: Client) => T): Promise<T[]>;
|
public eval<T>(fn: (client: Client) => T): Promise<T>;
|
||||||
public fetchClientValue(prop: string): Promise<unknown>;
|
public fetchClientValue(prop: string): Promise<unknown>;
|
||||||
public kill(): void;
|
public kill(): void;
|
||||||
public respawn(options?: { delay?: number; timeout?: number }): Promise<ChildProcess>;
|
public respawn(options?: { delay?: number; timeout?: number }): Promise<ChildProcess>;
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ import {
|
|||||||
Typing,
|
Typing,
|
||||||
User,
|
User,
|
||||||
VoiceChannel,
|
VoiceChannel,
|
||||||
|
Shard,
|
||||||
} from '.';
|
} from '.';
|
||||||
import type { ApplicationCommandOptionTypes } from './enums';
|
import type { ApplicationCommandOptionTypes } from './enums';
|
||||||
|
|
||||||
@@ -1050,3 +1051,7 @@ client.on('interactionCreate', async interaction => {
|
|||||||
assertType<string | null>(interaction.options.getSubcommandGroup(false));
|
assertType<string | null>(interaction.options.getSubcommandGroup(false));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
declare const shard: Shard;
|
||||||
|
|
||||||
|
assertType<Promise<number | null>>(shard.eval(c => c.readyTimestamp));
|
||||||
|
|||||||
Reference in New Issue
Block a user