File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1450,13 +1450,13 @@ describe('arg-parser', function () {
14501450 '--deprecatedField' ,
14511451 '100' ,
14521452 ] ,
1453- schema : {
1453+ schema : z . object ( {
14541454 extendedField : z . number ( ) ,
14551455 replacedField : z . number ( ) ,
14561456 deprecatedField : z . number ( ) . register ( argMetadata , {
14571457 deprecationReplacement : 'replacedField' ,
14581458 } ) ,
1459- } ,
1459+ } ) ,
14601460 } ) ;
14611461
14621462 expect ( options ) . to . deep . equal ( {
@@ -1486,9 +1486,9 @@ describe('arg-parser', function () {
14861486 '--unknownField' ,
14871487 '100' ,
14881488 ] ,
1489- schema : {
1489+ schema : z . object ( {
14901490 extendedField : z . enum ( [ '90' , '100' ] ) ,
1491- } ,
1491+ } ) ,
14921492 } )
14931493 ) . to . throw ( UnknownCliArgumentError , 'Unknown argument: --unknownField' ) ;
14941494 } ) ;
Original file line number Diff line number Diff line change @@ -228,11 +228,14 @@ export function parseArgsWithCliOptions({
228228} : {
229229 args : string [ ] ;
230230 /** Schema to extend the CLI options schema with. */
231- schema ?: Record < string , z . ZodTypeAny > ;
231+ schema ?: z . ZodObject ;
232232} ) : ReturnType < typeof parseArgs < CliOptions > > {
233233 const schema =
234234 schemaToExtend !== undefined
235- ? CliOptionsSchema . extend ( schemaToExtend )
235+ ? z . object ( {
236+ ...CliOptionsSchema . shape ,
237+ ...schemaToExtend . shape ,
238+ } )
236239 : CliOptionsSchema ;
237240 const { parsed, positional, deprecated } = parseArgs < ParsedCliOptions > ( {
238241 args,
You can’t perform that action at this time.
0 commit comments