Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
option and requiredOption's defaultValue parameter was `string | boolean` but the default for a variadic option should be an array. ``` program.option('--var <args...>', 'variadic arguments', ['1']) program.parse([]) > { var: ['1'] } program.parse(['--var', '1', '2']) > { var: ['1', '2'] } ``` If you use a string default you have to handle opts that are strings ``` // with a string arg the default value is a string. program.option('--var <args...>', 'variadic arguments', '1') program.parse([]) > { var: '1' } program.parse(['--var', '1', '2']) > { var: ['1', '2'] } ``` I chose unknown because it matches the jsdoc comments `@param {*} defaultValue` and the typing for `argument()`. Arguably adding `string[]` to the type, so it is `string[] | string | boolean` would be more useful, because without a coerce function the default value must be a string, boolean, or array of strings.
- Loading branch information