3
3
* @license Apache-2.0
4
4
*/
5
5
6
+ /** A set of options. */
7
+ export interface OptionSet {
8
+ [ key : string ] : number | string
9
+ }
10
+
6
11
/** Command line option description. */
7
12
export interface OptionDescription {
8
13
/** Textual description. */
9
14
description ?: string | string [ ] ,
10
15
/** Data type. One of (b)oolean [default], (i)nteger, (f)loat or (s)tring. Uppercase means multiple values. */
11
16
type ?: "b" | "i" | "f" | "s" | "I" | "F" | "S" ,
12
17
/** Substituted options, if any. */
13
- value ?: { [ key : string ] : number | string } ,
18
+ value ?: OptionSet ,
14
19
/** Short alias, if any. */
15
20
alias ?: string
16
21
/** The default value, if any. */
@@ -27,7 +32,7 @@ interface Config {
27
32
/** Parsing result. */
28
33
interface Result {
29
34
/** Parsed options. */
30
- options : { [ key : string ] : number | string } ,
35
+ options : OptionSet ,
31
36
/** Unknown options. */
32
37
unknown : string [ ] ,
33
38
/** Normal arguments. */
@@ -53,7 +58,7 @@ interface HelpOptions {
53
58
export function help ( config : Config , options ?: HelpOptions ) : string ;
54
59
55
60
/** Populates default values on a parsed options result. */
56
- export function addDefaults ( config : Config , options : { [ key : string ] : number | string } ) ;
61
+ export function addDefaults ( config : Config , options : OptionSet ) : OptionSet ;
57
62
58
63
/** Merges two sets of options into one, preferring the newer set. */
59
- export function merge ( config : Config , currentOptions : { [ key : string ] : number | string } , parentOptions : { [ key : string ] : number | string } ) ;
64
+ export function merge ( config : Config , currentOptions : OptionSet , parentOptions : OptionSet ) : OptionSet ;
0 commit comments