fix: types

This commit is contained in:
MARCROCK22 2024-11-17 19:04:30 -04:00
parent 33ac5a8246
commit 7e55ba9e3c
6 changed files with 7 additions and 13 deletions

View File

@ -3,6 +3,7 @@ import {
type Awaitable, type Awaitable,
type DeepPartial, type DeepPartial,
type If, type If,
type MakePartial,
type WatcherPayload, type WatcherPayload,
type WatcherSendToShard, type WatcherSendToShard,
hasIntent, hasIntent,
@ -228,7 +229,5 @@ export interface ClientOptions extends BaseClientOptions {
reply?: (ctx: CommandContext) => boolean; reply?: (ctx: CommandContext) => boolean;
}; };
handlePayload?: ShardManagerOptions['handlePayload']; handlePayload?: ShardManagerOptions['handlePayload'];
resharding?: Omit<NonNullable<ShardManagerOptions['resharding']>, 'getInfo'> & { resharding?: MakePartial<NonNullable<ShardManagerOptions['resharding']>, 'getInfo'>;
getInfo?: NonNullable<ShardManagerOptions['resharding']>['getInfo'];
};
} }

View File

@ -9,6 +9,6 @@ export class HttpClient extends BaseClient {
async start(options: DeepPartial<Omit<StartOptions, 'connection' | 'eventsDir'>> = {}) { async start(options: DeepPartial<Omit<StartOptions, 'connection' | 'eventsDir'>> = {}) {
await super.start(options); await super.start(options);
return this.execute(options.httpConnection ?? {}); return this.execute(options.httpConnection);
} }
} }

View File

@ -1,6 +1,7 @@
import type { UsingClient } from '../commands'; import type { UsingClient } from '../commands';
import type { Awaitable } from '../common';
export interface HttpServerAdapter { export interface HttpServerAdapter {
client: UsingClient; client: UsingClient;
start?(path: `/${string}`): any; start?(path: `/${string}`): Awaitable<unknown>;
} }

View File

@ -180,7 +180,7 @@ export class OptionResolver {
const channel = resolved.channels?.[value]; const channel = resolved.channels?.[value];
if (channel) { 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]; const role = resolved.roles?.[value];

View File

@ -89,12 +89,6 @@ export type NulleableCoalising<A, B> = NonFalsy<A> extends never ? B : A;
export type TupleOr<A, T> = ValueOf<A> extends never ? A : TupleOr<ArrayFirsElement<T>, Tail<T>>; export type TupleOr<A, T> = ValueOf<A> extends never ? A : TupleOr<ArrayFirsElement<T>, Tail<T>>;
export type PickPartial<T, K extends keyof T> = {
[P in keyof T]?: T[P] | undefined;
} & {
[P in K]: T[P];
};
export type MakeRequired<T, K extends keyof T = keyof T> = T & { [P in K]-?: NonFalsy<T[P]> }; export type MakeRequired<T, K extends keyof T = keyof T> = T & { [P in K]-?: NonFalsy<T[P]> };
export type NonFalsy<T> = T extends false | 0 | '' | null | undefined | 0n ? never : T; export type NonFalsy<T> = T extends false | 0 | '' | null | undefined | 0n ? never : T;

View File

@ -215,7 +215,7 @@ export class EventHandler extends BaseHandler {
t: name, t: name,
d: packet, d: packet,
} as GatewayDispatchPayload); } as GatewayDispatchPayload);
await (Event.run as any)(hook, client, shardId); await Event.run(hook, client, shardId);
} catch (e) { } catch (e) {
await this.onFail(name, e); await this.onFail(name, e);
} }