Skip to content

fix: activate zero-argument boolean defaults - #557

Closed
xiehuanyi wants to merge 1 commit into
yargs:mainfrom
xiehuanyi:fix/zero-nargs-boolean-default-round3
Closed

xiehuanyi wants to merge 1 commit into
yargs:mainfrom
xiehuanyi:fix/zero-nargs-boolean-default-round3

Conversation

@xiehuanyi

Copy link
Copy Markdown

An explicitly supplied option with narg: 0 and a boolean false default currently stays false, including through aliases. Activate the flag when its inferred type and fallback value are boolean. Absent flags and explicitly typed string/number fallback values keep their existing behavior.

Fixes #418.

Validation: the alias regression fails on the original implementation; absent-flag and typed-value controls pass. All 365 parser tests, 20 TypeScript tests, and lint pass.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@shadowspawn

Copy link
Copy Markdown
Member

This looks like a drive-by AI contribution.

This may get looked at and used when the issue is prioritised.

The human maintainer does not have time to review all AI heavy PRs that are opened.

For more, see draft AI Policy yargs/yargs#2606

@shadowspawn shadowspawn closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default value of false doesn't work for narg: { flag: 0 }

3 participants