Commit 59f3313 1 parent 67037d5 commit 59f3313 Copy full SHA for 59f3313
File tree 6 files changed +174
-203
lines changed
fixture-projects/cli/parsing/tasks-and-subtasks
6 files changed +174
-203
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ export class NewTaskDefinitionBuilderImplementation
109
109
name : string ;
110
110
description ?: string ;
111
111
type ?: T ;
112
- defaultValue ? : ArgumentTypeToValueType < T > ;
112
+ defaultValue : ArgumentTypeToValueType < T > ;
113
113
} ) : this {
114
114
const argumentType = type ?? ArgumentType . STRING ;
115
115
@@ -131,10 +131,7 @@ export class NewTaskDefinitionBuilderImplementation
131
131
} ) ;
132
132
}
133
133
134
- if (
135
- defaultValue !== undefined &&
136
- ! isArgumentValueValid ( argumentType , defaultValue )
137
- ) {
134
+ if ( ! isArgumentValueValid ( argumentType , defaultValue ) ) {
138
135
throw new HardhatError (
139
136
HardhatError . ERRORS . TASK_DEFINITIONS . INVALID_VALUE_FOR_TYPE ,
140
137
{
@@ -342,7 +339,7 @@ export class TaskOverrideDefinitionBuilderImplementation
342
339
name : string ;
343
340
description ?: string ;
344
341
type ?: T ;
345
- defaultValue ? : ArgumentTypeToValueType < T > ;
342
+ defaultValue : ArgumentTypeToValueType < T > ;
346
343
} ) : this {
347
344
const argumentType = type ?? ArgumentType . STRING ;
348
345
@@ -364,10 +361,7 @@ export class TaskOverrideDefinitionBuilderImplementation
364
361
} ) ;
365
362
}
366
363
367
- if (
368
- defaultValue !== undefined &&
369
- ! isArgumentValueValid ( argumentType , defaultValue )
370
- ) {
364
+ if ( ! isArgumentValueValid ( argumentType , defaultValue ) ) {
371
365
throw new HardhatError (
372
366
HardhatError . ERRORS . TASK_DEFINITIONS . INVALID_VALUE_FOR_TYPE ,
373
367
{
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export interface TaskArgumentDefinition<T extends ArgumentType = ArgumentType> {
45
45
*/
46
46
export interface TaskOptionDefinition < T extends ArgumentType = ArgumentType >
47
47
extends TaskArgumentDefinition < T > {
48
- defaultValue ? : ArgumentTypeToValueType < T > ;
48
+ defaultValue : ArgumentTypeToValueType < T > ;
49
49
}
50
50
51
51
/**
@@ -201,14 +201,13 @@ export interface NewTaskDefinitionBuilder {
201
201
*
202
202
* The type of the argument defaults to `ArgumentType.STRING`.
203
203
*
204
- * The default value, if provided, should be of the same type as the
205
- * argument.
204
+ * The default value should be of the same type as the argument.
206
205
*/
207
206
addOption < T extends ArgumentType > ( optionConfig : {
208
207
name : string ;
209
208
description ?: string ;
210
209
type ?: T ;
211
- defaultValue ? : ArgumentTypeToValueType < T > ;
210
+ defaultValue : ArgumentTypeToValueType < T > ;
212
211
} ) : this;
213
212
214
213
/**
@@ -291,7 +290,7 @@ export interface TaskOverrideDefinitionBuilder {
291
290
name : string ;
292
291
description ?: string ;
293
292
type ?: T ;
294
- defaultValue ? : ArgumentTypeToValueType < T > ;
293
+ defaultValue : ArgumentTypeToValueType < T > ;
295
294
} ) : this;
296
295
297
296
/**
You can’t perform that action at this time.
0 commit comments