Skip to content

Conversation

shadowspawn
Copy link
Collaborator

@shadowspawn shadowspawn commented Apr 10, 2022

Currently the type property is optional and defaults to boolean, but this is a bit opaque.

Closes: #94

Make it an error to leave out the type:

parseArgs({
  options: {
    foo: { },
  },
});
ERR_INVALID_ARG_TYPE [TypeError]: options.foo.type must be ('string|boolean') got undefined

Correct:

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

@shadowspawn shadowspawn marked this pull request as draft April 10, 2022 07:53
@shadowspawn shadowspawn marked this pull request as ready for review April 10, 2022 08:13
@bcoe bcoe merged commit 02cd018 into pkgjs:main Apr 10, 2022
@shadowspawn shadowspawn deleted the feature/require-option-type branch April 10, 2022 20:19
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.

Make type mandatory for configured options
2 participants