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

fix: Command.String options incorrectly inferred as string | boolean #59

Merged
merged 3 commits into from
Nov 27, 2020

Conversation

kherock
Copy link
Contributor

@kherock kherock commented Nov 26, 2020

In v3 implementation, I think the overloads on Command.String were defined in the wrong order. It doesn't seem like it's possible to define an option with an initial value without Clipanion thinking the value is possibly a boolean.

@kherock
Copy link
Contributor Author

kherock commented Nov 26, 2020

It wasn't too clear on how to represent the current issue in the test suite, but I have screenshots that at least shows the problem that this PR solves:
image

with these changes:
image

StringOptionNoBoolean is more specific than StringOptionTolerateBoolean
and needs be listed first to correctly infer plain string types.
@arcanis arcanis merged commit 4b79bdd into arcanis:master Nov 27, 2020
@arcanis
Copy link
Owner

arcanis commented Nov 27, 2020

Thanks! I've added an inference test file to avoid problems like this in the future 👍

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.

None yet

2 participants