types: corrected shard broadcastEval (#5834)

This commit is contained in:
Almeida
2021-06-13 19:30:28 +01:00
committed by GitHub
parent 4dbcaf76c3
commit a0a56e2cb3

23
typings/index.d.ts vendored
View File

@@ -1637,13 +1637,12 @@ declare module 'discord.js' {
public readonly ids: number[];
public mode: ShardingManagerMode;
public parentPort: any | null;
public broadcastEval<T>(fn: (client: Client) => T): Promise<T[]>;
public broadcastEval<T>(fn: (client: Client) => T, options: { shard: number }): Promise<T>;
public broadcastEval<T, P>(fn: (client: Client, context: P) => T, options: { context: P }): Promise<T[]>;
public broadcastEval<T, P>(
fn: (client: Client, context: P) => T,
{ shard: undefined, context: P }?: BroadcastEvalOptions,
): Promise<T[]>;
public broadcastEval<T, P>(
fn: (client: Client, context: P) => T,
{ shard: number, context: P }: BroadcastEvalOptions,
options: { context: P; shard: number },
): Promise<T>;
public fetchClientValues(prop: string): Promise<any[]>;
public fetchClientValues(prop: string, shard: number): Promise<any>;
@@ -1667,13 +1666,12 @@ declare module 'discord.js' {
public totalShards: number | 'auto';
public shardList: number[] | 'auto';
public broadcast(message: any): Promise<Shard[]>;
public broadcastEval<T>(fn: (client: Client) => T): Promise<T[]>;
public broadcastEval<T>(fn: (client: Client) => T, options: { shard: number }): Promise<T>;
public broadcastEval<T, P>(fn: (client: Client, context: P) => T, options: { context: P }): Promise<T[]>;
public broadcastEval<T, P>(
fn: (client: Client, context: P) => T,
{ shard: undefined, context: P }?: BroadcastEvalOptions,
): Promise<T[]>;
public broadcastEval<T, P>(
fn: (client: Client, context: P) => T,
{ shard: number, context: P }: BroadcastEvalOptions,
options: { context: P; shard: number },
): Promise<T>;
public createShard(id: number): Shard;
public fetchClientValues(prop: string): Promise<any[]>;
@@ -2565,11 +2563,6 @@ declare module 'discord.js' {
| N
| Readonly<BitField<T, N>>;
interface BroadcastEvalOptions<T = unknown> {
shard?: number;
context?: T;
}
type BufferResolvable = Buffer | string;
interface ChannelCreationOverwrites {