From f288292208b1c8bc6070fbba73fcc583a5538d81 Mon Sep 17 00:00:00 2001 From: MARCROCK22 Date: Sun, 15 Sep 2024 23:33:37 +0000 Subject: [PATCH] fix: types --- biome.json | 13 +++++++++++-- src/commands/applications/chat.ts | 13 ++++--------- src/commands/handle.ts | 4 ++-- src/common/types/util.ts | 1 - 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/biome.json b/biome.json index 4ac270d..11a1f4e 100644 --- a/biome.json +++ b/biome.json @@ -8,7 +8,15 @@ }, "files": { "ignoreUnknown": true, - "ignore": ["node_modules/", "build", "lib", "__test__", "package.json", "tsconfig.json", ".vscode"] + "ignore": [ + "node_modules/", + "build", + "lib", + "__test__", + "package.json", + "tsconfig.json", + ".vscode" + ] }, "formatter": { "enabled": true, @@ -62,7 +70,8 @@ "complexity": { "noForEach": "off", "noExcessiveCognitiveComplexity": "off", - "noUselessConstructor": "off" + "noUselessConstructor": "off", + "noBannedTypes": "off" }, "performance": { "noBarrelFile": "off", diff --git a/src/commands/applications/chat.ts b/src/commands/applications/chat.ts index 62dcd98..e98d72c 100644 --- a/src/commands/applications/chat.ts +++ b/src/commands/applications/chat.ts @@ -149,7 +149,7 @@ export class BaseCommand { /** @internal */ async __runOptions( - ctx: CommandContext, + ctx: CommandContext<{}, never>, resolver: OptionResolverStructure, ): Promise<[boolean, OnOptionsReturnObject]> { if (!this?.options?.length) { @@ -202,12 +202,7 @@ export class BaseCommand { /** @internal */ static __runMiddlewares( - context: - | CommandContext - | ComponentContext - | MenuCommandContext - | ModalContext - | EntryPointContext, + context: CommandContext<{}, never> | ComponentContext | MenuCommandContext | ModalContext | EntryPointContext, middlewares: (keyof RegisteredMiddlewares)[], global: boolean, ): Promise<{ error?: string; pass?: boolean }> { @@ -250,12 +245,12 @@ export class BaseCommand { } /** @internal */ - __runMiddlewares(context: CommandContext) { + __runMiddlewares(context: CommandContext<{}, never>) { return BaseCommand.__runMiddlewares(context, this.middlewares as (keyof RegisteredMiddlewares)[], false); } /** @internal */ - __runGlobalMiddlewares(context: CommandContext) { + __runGlobalMiddlewares(context: CommandContext<{}, never>) { return BaseCommand.__runMiddlewares( context, (context.client.options?.globalMiddlewares ?? []) as (keyof RegisteredMiddlewares)[], diff --git a/src/commands/handle.ts b/src/commands/handle.ts index 2a9fa58..b5a06f9 100644 --- a/src/commands/handle.ts +++ b/src/commands/handle.ts @@ -531,7 +531,7 @@ export class HandleCommand { async runGlobalMiddlewares( command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, - context: CommandContext | MenuCommandContext | EntryPointContext, + context: CommandContext<{}, never> | MenuCommandContext | EntryPointContext, ) { try { const resultRunGlobalMiddlewares = await BaseCommand.__runMiddlewares( @@ -559,7 +559,7 @@ export class HandleCommand { async runMiddlewares( command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, - context: CommandContext | MenuCommandContext | EntryPointContext, + context: CommandContext<{}, never> | MenuCommandContext | EntryPointContext, ) { try { const resultRunMiddlewares = await BaseCommand.__runMiddlewares( diff --git a/src/common/types/util.ts b/src/common/types/util.ts index b95f386..67dd484 100644 --- a/src/common/types/util.ts +++ b/src/common/types/util.ts @@ -211,7 +211,6 @@ export type Clean = DropT; export type PartialAvoid = Identify & Partial>; -//biome-ignore lint/complexity/noBannedTypes: export type PartialClass = PartialAvoid; export type AtLeastOne<