diff --git a/src/client/client.ts b/src/client/client.ts index 12b103a..20e4563 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -116,8 +116,8 @@ export class Client extends BaseClient { compress: this.options?.gateway?.compress, resharding: { getInfo: () => this.proxy.gateway.bot.get(), - interval: this.options?.resharding?.interval as number, - percentage: this.options?.resharding?.percentage as number, + interval: this.options?.resharding?.interval, + percentage: this.options?.resharding?.percentage, reloadGuilds: ids => { this.__handleGuilds = this.__handleGuilds?.concat(ids) ?? ids; }, diff --git a/src/common/types/util.ts b/src/common/types/util.ts index 442525a..4ad6960 100644 --- a/src/common/types/util.ts +++ b/src/common/types/util.ts @@ -16,12 +16,18 @@ export type StringToNumber = T extends `${infer N extends numb export type MakePartial = Omit & { [P in K]?: T[P] }; +export type MakeDeepPartial = Omit & { + [P in K]?: DeepPartial; +}; + export type DeepPartial = { - [K in keyof T]?: T[K] extends Record - ? DeepPartial - : T[K] extends (infer I)[] - ? DeepPartial[] - : Partial; + [K in keyof T]?: T[K] extends (...args: any[]) => any + ? T[K] + : T[K] extends Record + ? DeepPartial + : T[K] extends (infer I)[] + ? DeepPartial[] + : Partial; }; export type OmitInsert = I extends [] ? Omit & I[number] : Omit & I; diff --git a/src/websocket/discord/sharder.ts b/src/websocket/discord/sharder.ts index bf28bb5..5ddd4b7 100644 --- a/src/websocket/discord/sharder.ts +++ b/src/websocket/discord/sharder.ts @@ -19,6 +19,7 @@ import { DynamicBucket } from '../structures'; import { ConnectQueue } from '../structures/timeout'; import { Shard } from './shard'; import type { ShardManagerOptions, WorkerData } from './shared'; +import type { MakeDeepPartial } from '../../common/types/util'; let parentPort: import('node:worker_threads').MessagePort; let workerData: WorkerData; @@ -28,7 +29,7 @@ export class ShardManager extends Map { options: MakeRequired; debugger?: Logger; - constructor(options: ShardManagerOptions) { + constructor(options: MakeDeepPartial) { super(); this.options = MergeOptions( ShardManagerDefaults,