Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(yargs): Types for arg in MiddlewareFunction #52265

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions types/yargs/index.d.ts
Expand Up @@ -149,15 +149,15 @@ declare namespace yargs {
description: string,
builder?: BuilderCallback<T, U>,
handler?: (args: Arguments<U>) => void,
middlewares?: MiddlewareFunction[],
middlewares?: Array<MiddlewareFunction<U>>,
deprecated?: boolean | string,
): Argv<U>;
command<O extends { [key: string]: Options }>(
command: string | ReadonlyArray<string>,
description: string,
builder?: O,
handler?: (args: Arguments<InferredOptionTypes<O>>) => void,
middlewares?: MiddlewareFunction[],
middlewares?: Array<MiddlewareFunction<InferredOptionTypes<O>>>,
deprecated?: boolean | string,
): Argv<T>;
command<U>(command: string | ReadonlyArray<string>, description: string, module: CommandModule<T, U>): Argv<U>;
Expand All @@ -166,7 +166,7 @@ declare namespace yargs {
showInHelp: false,
builder?: BuilderCallback<T, U>,
handler?: (args: Arguments<U>) => void,
middlewares?: MiddlewareFunction[],
middlewares?: Array<MiddlewareFunction<U>>,
deprecated?: boolean | string,
): Argv<T>;
command<O extends { [key: string]: Options }>(
Expand Down Expand Up @@ -835,7 +835,7 @@ declare namespace yargs {
type SyncCompletionFunction = (current: string, argv: any) => string[];
type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void) => void;
type PromiseCompletionFunction = (current: string, argv: any) => Promise<string[]>;
type MiddlewareFunction<T = {}> = (args: Arguments<T>) => void;
type MiddlewareFunction<U> = (args: Arguments<U>) => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should still have a default type for U

type Choices = ReadonlyArray<string | number | true | undefined>;
type PositionalOptionsType = "boolean" | "number" | "string";
}
Expand Down