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

Option's default value is not tested against validator #166

Open
sergei-dyshel opened this issue Aug 12, 2024 · 0 comments
Open

Option's default value is not tested against validator #166

sergei-dyshel opened this issue Aug 12, 2024 · 0 comments

Comments

@sergei-dyshel
Copy link

I would expect TS compiler to warn me when defining e.g.:

  choice = Option.String("--choice", "d", {
    description: "Choice option",
    validator: t.isEnum(["a", "b", "c"] as const),
  });

that "d" does not pass validation, resulting in this error during runtime:

Usage Error: Invalid value for choice: expected one of "a", "b", or "c" (got "d"
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

No branches or pull requests

1 participant