fix: types

This commit is contained in:
MARCROCK22 2024-09-15 23:33:37 +00:00
parent ee135a2667
commit f288292208
4 changed files with 17 additions and 14 deletions

View File

@ -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",

View File

@ -149,7 +149,7 @@ export class BaseCommand {
/** @internal */
async __runOptions(
ctx: CommandContext<never, never>,
ctx: CommandContext<{}, never>,
resolver: OptionResolverStructure,
): Promise<[boolean, OnOptionsReturnObject]> {
if (!this?.options?.length) {
@ -202,12 +202,7 @@ export class BaseCommand {
/** @internal */
static __runMiddlewares(
context:
| CommandContext<never, never>
| ComponentContext
| MenuCommandContext<any>
| ModalContext
| EntryPointContext,
context: CommandContext<{}, never> | ComponentContext | MenuCommandContext<any> | ModalContext | EntryPointContext,
middlewares: (keyof RegisteredMiddlewares)[],
global: boolean,
): Promise<{ error?: string; pass?: boolean }> {
@ -250,12 +245,12 @@ export class BaseCommand {
}
/** @internal */
__runMiddlewares(context: CommandContext<never, never>) {
__runMiddlewares(context: CommandContext<{}, never>) {
return BaseCommand.__runMiddlewares(context, this.middlewares as (keyof RegisteredMiddlewares)[], false);
}
/** @internal */
__runGlobalMiddlewares(context: CommandContext<never, never>) {
__runGlobalMiddlewares(context: CommandContext<{}, never>) {
return BaseCommand.__runMiddlewares(
context,
(context.client.options?.globalMiddlewares ?? []) as (keyof RegisteredMiddlewares)[],

View File

@ -531,7 +531,7 @@ export class HandleCommand {
async runGlobalMiddlewares(
command: Command | ContextMenuCommand | SubCommand | EntryPointCommand,
context: CommandContext<never, never> | MenuCommandContext<any> | EntryPointContext,
context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext,
) {
try {
const resultRunGlobalMiddlewares = await BaseCommand.__runMiddlewares(
@ -559,7 +559,7 @@ export class HandleCommand {
async runMiddlewares(
command: Command | ContextMenuCommand | SubCommand | EntryPointCommand,
context: CommandContext<never, never> | MenuCommandContext<any> | EntryPointContext,
context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext,
) {
try {
const resultRunMiddlewares = await BaseCommand.__runMiddlewares(

View File

@ -211,7 +211,6 @@ export type Clean<T> = DropT<T, never>;
export type PartialAvoid<U, T> = Identify<KeepT<T, U> & Partial<T>>;
//biome-ignore lint/complexity/noBannedTypes:
export type PartialClass<T> = PartialAvoid<Function, T>;
export type AtLeastOne<