types(Shard): eval returns a promise resolving with T instead of T[] (#6901)

This commit is contained in:
SpaceEEC
2021-10-29 00:47:18 +02:00
committed by GitHub
parent ee93a27e15
commit 14d9a9901b
2 changed files with 6 additions and 1 deletions

2
typings/index.d.ts vendored
View File

@@ -1746,7 +1746,7 @@ export class Shard extends EventEmitter {
public ready: boolean;
public worker: Worker | null;
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 kill(): void;
public respawn(options?: { delay?: number; timeout?: number }): Promise<ChildProcess>;

View File

@@ -76,6 +76,7 @@ import {
Typing,
User,
VoiceChannel,
Shard,
} from '.';
import type { ApplicationCommandOptionTypes } from './enums';
@@ -1050,3 +1051,7 @@ client.on('interactionCreate', async interaction => {
assertType<string | null>(interaction.options.getSubcommandGroup(false));
}
});
declare const shard: Shard;
assertType<Promise<number | null>>(shard.eval(c => c.readyTimestamp));