Skip to content

Commit

Permalink
Copy type for parents and JSDoc comment for parent to .d.ts file
Browse files Browse the repository at this point in the history
A corresponding type test for parents has been added.
  • Loading branch information
aweebit committed Aug 5, 2023
1 parent 724d414 commit 5828e16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ export class Command {
processedArgs: any[];
readonly commands: readonly Command[];
readonly options: readonly Option[];
parents: Command[];
/**
* Last added parent command,
* or parent command in last parse call.
*/
parent: Command | null;

constructor(name?: string);
Expand Down
1 change: 1 addition & 0 deletions typings/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ expectType<string[]>(program.args);
expectType<any[]>(program.processedArgs);
expectType<readonly commander.Command[]>(program.commands);
expectType<readonly commander.Option[]>(program.options);
expectType<commander.Command[]>(program.parents);
expectType<commander.Command | null>(program.parent);

// version
Expand Down

0 comments on commit 5828e16

Please sign in to comment.