Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make type mandatory for configured options #94

Closed
bakkot opened this issue Apr 10, 2022 · 2 comments · Fixed by #95
Closed

Make type mandatory for configured options #94

bakkot opened this issue Apr 10, 2022 · 2 comments · Fixed by #95

Comments

@bakkot
Copy link
Collaborator

bakkot commented Apr 10, 2022

@bcoe suggested this here. I'm in favor of it, and wanted to open an issue for it so it doesn't get lost.

This would definitely apply to strict. I don't know if it should also apply to non-strict. I'm still not entirely clear on what non-strict is for, which makes it hard to judge what's right for it.

I note that if if type is not required for non-strict, you have odd cases like

parseArgs({ options: { foo: { multiple: true } }, args: ['--foo', 'a', '--foo'] })

where... would that give you { values: { foo: ['a', true] } }, or what?

@shadowspawn
Copy link
Collaborator

I don't know if it should also apply to non-strict.

I think it applies for both strict and non-strict.

@shadowspawn
Copy link
Collaborator

shadowspawn commented Apr 10, 2022

Per the original comment, the idea is to make the implicit configuration option illegal.

Implicit boolean type, no clues:

parseArgs({
  options: {
    foo: {},
  },
});

Explicit:

parseArgs({
  options: {
    foo: { type: 'boolean' },
  },
});

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 a pull request may close this issue.

2 participants