From 7e55ba9e3ce72d29b0aeac87c66823a5d41778a0 Mon Sep 17 00:00:00 2001 From: MARCROCK22 Date: Sun, 17 Nov 2024 19:04:30 -0400 Subject: [PATCH] fix: types --- src/client/client.ts | 5 ++--- src/client/httpclient.ts | 2 +- src/client/types.ts | 3 ++- src/commands/optionresolver.ts | 2 +- src/common/types/util.ts | 6 ------ src/events/handler.ts | 2 +- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/client/client.ts b/src/client/client.ts index ece7aec..9d13578 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -3,6 +3,7 @@ import { type Awaitable, type DeepPartial, type If, + type MakePartial, type WatcherPayload, type WatcherSendToShard, hasIntent, @@ -228,7 +229,5 @@ export interface ClientOptions extends BaseClientOptions { reply?: (ctx: CommandContext) => boolean; }; handlePayload?: ShardManagerOptions['handlePayload']; - resharding?: Omit, 'getInfo'> & { - getInfo?: NonNullable['getInfo']; - }; + resharding?: MakePartial, 'getInfo'>; } diff --git a/src/client/httpclient.ts b/src/client/httpclient.ts index dbd30fb..c2963b7 100644 --- a/src/client/httpclient.ts +++ b/src/client/httpclient.ts @@ -9,6 +9,6 @@ export class HttpClient extends BaseClient { async start(options: DeepPartial> = {}) { await super.start(options); - return this.execute(options.httpConnection ?? {}); + return this.execute(options.httpConnection); } } diff --git a/src/client/types.ts b/src/client/types.ts index df94b17..15ff2ad 100644 --- a/src/client/types.ts +++ b/src/client/types.ts @@ -1,6 +1,7 @@ import type { UsingClient } from '../commands'; +import type { Awaitable } from '../common'; export interface HttpServerAdapter { client: UsingClient; - start?(path: `/${string}`): any; + start?(path: `/${string}`): Awaitable; } diff --git a/src/commands/optionresolver.ts b/src/commands/optionresolver.ts index f61a3fe..622731c 100644 --- a/src/commands/optionresolver.ts +++ b/src/commands/optionresolver.ts @@ -180,7 +180,7 @@ export class OptionResolver { const channel = resolved.channels?.[value]; if (channel) { - resolve.channel = 'fetch' in channel ? (channel as unknown as AllChannels) : channelFrom(channel, this.client); + resolve.channel = channelFrom(channel, this.client); } const role = resolved.roles?.[value]; diff --git a/src/common/types/util.ts b/src/common/types/util.ts index 67dd484..eea49db 100644 --- a/src/common/types/util.ts +++ b/src/common/types/util.ts @@ -89,12 +89,6 @@ export type NulleableCoalising = NonFalsy extends never ? B : A; export type TupleOr = ValueOf extends never ? A : TupleOr, Tail>; -export type PickPartial = { - [P in keyof T]?: T[P] | undefined; -} & { - [P in K]: T[P]; -}; - export type MakeRequired = T & { [P in K]-?: NonFalsy }; export type NonFalsy = T extends false | 0 | '' | null | undefined | 0n ? never : T; diff --git a/src/events/handler.ts b/src/events/handler.ts index cb7961b..8d57a1e 100644 --- a/src/events/handler.ts +++ b/src/events/handler.ts @@ -215,7 +215,7 @@ export class EventHandler extends BaseHandler { t: name, d: packet, } as GatewayDispatchPayload); - await (Event.run as any)(hook, client, shardId); + await Event.run(hook, client, shardId); } catch (e) { await this.onFail(name, e); }