-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Handling of undefined typings in tuples #213
Comments
kevinresol
changed the title
Handling of undefined in tuples
Handling of undefined typings in tuples
Jan 11, 2024
This behavior is expected. In order to support this we would need to distribute unions in the input type even without using See the discussion in issue #145 for some additional context on how type narrowing and exhaustive work in ts-pattern |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
In the code below, all occurrences of
v1
andv2
are inferred asstring | undefined
but in fact they should bestring
because the undefined cases are already handled.In fact, it works if the pattern is a single value instead of a tuple:
Code Sandbox with a minimal reproduction case
https://codesandbox.io/p/sandbox/crazy-galileo-3zsfmh
Versions
The text was updated successfully, but these errors were encountered: