Incorrect `default` type should not be allowed
Open
Nobody has claimed this yet.
enhancement
help wanted
- Dominant language
- JavaScript
- Stars
- 519
- Forks
- 129
- Avg merge
- 1h 34m
- Merged PRs (30d)
- 1
Description
The parser should not allow setting the incorrect type for default.
yargs([], {number: ['foo'], default: {foo: 'x'}});
//=> { _: [], foo: 'x' }
The above should not be allowed as we defined foo as a number, but the default is set to a string. This should throw an error to prevent mistakes.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the parser handles the number declaration together with the default object shown in the issue. Add coverage for the mismatched string default and verify that it throws an error, while a correctly typed default remains accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100