diff --git a/lib/yargs-parser.ts b/lib/yargs-parser.ts index 48a2d0f2..ac1954b6 100644 --- a/lib/yargs-parser.ts +++ b/lib/yargs-parser.ts @@ -626,7 +626,8 @@ export class YargsParser { // increment a count given as arg (either no value or value parsed as boolean) if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) { - value = increment() + // COUNT_INCREMENT is a unique sentinel, not the number 1. + value = COUNT_INCREMENT as unknown as typeof value } // Set normalized value when key is in 'normalize' and in 'arrays' @@ -850,7 +851,7 @@ export class YargsParser { } } - if (value === increment()) { + if (value === COUNT_INCREMENT) { o[key] = increment(o[key]) } else if (Array.isArray(o[key])) { if (duplicate && isTypeArray && isValueArray) { @@ -1098,6 +1099,11 @@ function combineAliases (aliases: Dictionary): Dictionary