Skip to content

Commit

Permalink
Add attributeName to Option typings (#1483)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn authored Mar 8, 2021
1 parent 26223d0 commit d3a9e7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ declare namespace commander {
* Return option name.
*/
name(): string;

/**
* Return option name, in a camelcase format that can be used
* as a object attribute key.
*/
attributeName(): string;
}
type OptionConstructor = new (flags: string, description?: string) => Option;

Expand Down
3 changes: 3 additions & 0 deletions typings/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,6 @@ expectType<commander.Option>(baseOption.choices(['a', 'b']));

// name
expectType<string>(baseOption.name());

// attributeName
expectType<string>(baseOption.attributeName());

0 comments on commit d3a9e7a

Please sign in to comment.