-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
parseArgs Type Definition #47487
Comments
cc @bcoe @RaisinTen @aduh95 (pinging Ben who added it and some people who reviewed that since I'm not sure what team to ping) |
This was deliberate in case there was expansion of types in the future or by third parties. The original design had a |
I think implicitly we were thinking of a key/value lookup of the options properties, but an array could work too. I think the difference is probably not compelling enough to change, also with Proposal for refactor leading to current configuration: Edit: Also I don't know if it would be possible to do the strong typing of the parse results in TypeScript if the options configuration was a plain array. |
(Two good questions @marcobarriosfi ) |
(The TS bit is possible to type though I actually personally like the current API better) |
Instead of having a
type
property with either a"string"
or"boolean"
value, I believe it would be more intuitive to have aboolean
property with eithertrue
orfalse
value, with the default value being false.Furthermore, I would prefer the options to be an array of objects, as this would make it easier work with them.
Thank you for including the parseArgs feature in Node!
The text was updated successfully, but these errors were encountered: