mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
feat: makeDeepPartial type
This commit is contained in:
parent
3374252a36
commit
751f9cedb2
@ -116,8 +116,8 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
|
|||||||
compress: this.options?.gateway?.compress,
|
compress: this.options?.gateway?.compress,
|
||||||
resharding: {
|
resharding: {
|
||||||
getInfo: () => this.proxy.gateway.bot.get(),
|
getInfo: () => this.proxy.gateway.bot.get(),
|
||||||
interval: this.options?.resharding?.interval as number,
|
interval: this.options?.resharding?.interval,
|
||||||
percentage: this.options?.resharding?.percentage as number,
|
percentage: this.options?.resharding?.percentage,
|
||||||
reloadGuilds: ids => {
|
reloadGuilds: ids => {
|
||||||
this.__handleGuilds = this.__handleGuilds?.concat(ids) ?? ids;
|
this.__handleGuilds = this.__handleGuilds?.concat(ids) ?? ids;
|
||||||
},
|
},
|
||||||
|
@ -16,8 +16,14 @@ export type StringToNumber<T extends string> = T extends `${infer N extends numb
|
|||||||
|
|
||||||
export type MakePartial<T, K extends keyof T> = Omit<T, K> & { [P in K]?: T[P] };
|
export type MakePartial<T, K extends keyof T> = Omit<T, K> & { [P in K]?: T[P] };
|
||||||
|
|
||||||
|
export type MakeDeepPartial<T, K extends keyof T> = Omit<T, K> & {
|
||||||
|
[P in K]?: DeepPartial<T[P]>;
|
||||||
|
};
|
||||||
|
|
||||||
export type DeepPartial<T> = {
|
export type DeepPartial<T> = {
|
||||||
[K in keyof T]?: T[K] extends Record<any, any>
|
[K in keyof T]?: T[K] extends (...args: any[]) => any
|
||||||
|
? T[K]
|
||||||
|
: T[K] extends Record<any, any>
|
||||||
? DeepPartial<T[K]>
|
? DeepPartial<T[K]>
|
||||||
: T[K] extends (infer I)[]
|
: T[K] extends (infer I)[]
|
||||||
? DeepPartial<I>[]
|
? DeepPartial<I>[]
|
||||||
|
@ -19,6 +19,7 @@ import { DynamicBucket } from '../structures';
|
|||||||
import { ConnectQueue } from '../structures/timeout';
|
import { ConnectQueue } from '../structures/timeout';
|
||||||
import { Shard } from './shard';
|
import { Shard } from './shard';
|
||||||
import type { ShardManagerOptions, WorkerData } from './shared';
|
import type { ShardManagerOptions, WorkerData } from './shared';
|
||||||
|
import type { MakeDeepPartial } from '../../common/types/util';
|
||||||
|
|
||||||
let parentPort: import('node:worker_threads').MessagePort;
|
let parentPort: import('node:worker_threads').MessagePort;
|
||||||
let workerData: WorkerData;
|
let workerData: WorkerData;
|
||||||
@ -28,7 +29,7 @@ export class ShardManager extends Map<number, Shard> {
|
|||||||
options: MakeRequired<ShardManagerOptions, keyof typeof ShardManagerDefaults>;
|
options: MakeRequired<ShardManagerOptions, keyof typeof ShardManagerDefaults>;
|
||||||
debugger?: Logger;
|
debugger?: Logger;
|
||||||
|
|
||||||
constructor(options: ShardManagerOptions) {
|
constructor(options: MakeDeepPartial<ShardManagerOptions, 'resharding'>) {
|
||||||
super();
|
super();
|
||||||
this.options = MergeOptions<ShardManager['options']>(
|
this.options = MergeOptions<ShardManager['options']>(
|
||||||
ShardManagerDefaults,
|
ShardManagerDefaults,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user