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

fix: add options field to Command type declaration #1825

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion typings/index.d.ts
Expand Up @@ -277,7 +277,8 @@ export interface OptionValues {
export class Command {
args: string[];
processedArgs: any[];
commands: Command[];
readonly commands: readonly Command[];
readonly options: readonly Option[];
parent: Command | null;

constructor(name?: string);
Expand Down
3 changes: 2 additions & 1 deletion typings/index.test-d.ts
Expand Up @@ -28,7 +28,8 @@ expectType<commander.Argument>(commander.createArgument('<foo>'));
expectType<string[]>(program.args);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expectType<any[]>(program.processedArgs);
expectType<commander.Command[]>(program.commands);
expectType<ReadonlyArray<commander.Command>>(program.commands);
expectType<ReadonlyArray<commander.Option>>(program.options);
expectType<commander.Command | null>(program.parent);

// version
Expand Down