File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,11 @@ type Options = {
41
41
[ key : string ] : boolean | string | string [ ] ;
42
42
} ;
43
43
44
- type ErrorResult = { ok : false ; error : string } ;
45
- type OkResult < T > = { ok : true ; options : T } ;
46
- type Result < T > = OkResult < T > | ErrorResult ;
44
+ type Result < T > = { ok : false ; error : string } | { ok : true ; options : T } ;
47
45
48
- const Ok = < T > ( options : T ) : OkResult < T > => ( { ok : true , options } ) ;
46
+ const Ok = < T > ( options : T ) : Result < T > => ( { ok : true , options } ) ;
49
47
50
- const Err = ( error : string ) : ErrorResult => ( {
48
+ const Err = < T > ( error : string ) : Result < T > => ( {
51
49
ok : false ,
52
50
error,
53
51
} ) ;
@@ -140,13 +138,13 @@ const createCommand = (name?: string): Command => {
140
138
* @param {object } [options] - Options for this declaration. Example `{ boolean: true, required: true }`
141
139
* @return {Command } The option declaration representation object
142
140
*/
143
- option : ( ...args ) : Command => {
141
+ option : ( ...args : DeclarationTuple ) : Command => {
144
142
const declaration = parseDeclaration ( args ) ;
145
143
ensureNamesUnique ( declaration , state . optionDeclarations ) ;
146
144
state . optionDeclarations . push ( declaration ) ;
147
145
return command ;
148
146
} ,
149
- parse : ( args ) : Result < Options > => {
147
+ parse : ( args : string [ ] ) : Result < Options > => {
150
148
const options : Options = { } ;
151
149
152
150
try {
You can’t perform that action at this time.
0 commit comments