Skip to content

Commit d3a9e7a

Browse files
authored
Add attributeName to Option typings (#1483)
1 parent 26223d0 commit d3a9e7a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

typings/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ declare namespace commander {
7878
* Return option name.
7979
*/
8080
name(): string;
81+
82+
/**
83+
* Return option name, in a camelcase format that can be used
84+
* as a object attribute key.
85+
*/
86+
attributeName(): string;
8187
}
8288
type OptionConstructor = new (flags: string, description?: string) => Option;
8389

typings/index.test-d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,6 @@ expectType<commander.Option>(baseOption.choices(['a', 'b']));
324324

325325
// name
326326
expectType<string>(baseOption.name());
327+
328+
// attributeName
329+
expectType<string>(baseOption.attributeName());

0 commit comments

Comments
 (0)