We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
constraints conditional types type variables nested
https://www.typescriptlang.org/play/?ts=5.7.0-dev.20240904#code/C4TwDgpgBAkgzgWQIbAMYAsCWA7A5gZWACcdcB5bCAGQgDcIAbAHgBUoIAPYCbAEzihxipAHxQAvFDadufAQAMkAEgDeQkngC+8gFBQoAfijEArhD1QAXFABmSBnAgBuHTpsnsqYJgD22WwBMTPjsXDz8gsJ4IgAUHNbwyGhYeIQa5JQ09Mz4IgCUUCoWDBDAxtam0JIcTlAA9HVQAKJERD5ExaW21nYOVVA19Y0tbR2arqCQsIgoGKRppCwA7j5ZjHCsobIR6qISUlvhCspqUbjaFkbSYXJQ8qq7WgBeuvr6RpUW+j32jhY-fRcbg8Xl8-hsAGZgodbo9cLF4tMknNUmdlqs6OtgvlCp0ysAKkQzPtBg1mq12njurZfv1SY0yABrKAAIxMZTg6B8JgYvFZ0CQ-ggFLGOiAA
type IsMatchingStringOneLevel<T extends string> = T extends `a${string}` ? true : false; function f2<S extends string>(x: IsMatchingStringOneLevel<S>) { let t: true = x; // Error let f: false = x; // Error } type IsMatchingStringTwoLevels<T extends string> = T extends `a${string}` ? T extends `${string}z` ? true : false : false; function f3<S extends string>(x: IsMatchingStringTwoLevels<S>) { let t: true = x; // Error let f: false = x; // Ok but should be an error }
It doesn't error on the fourth assignment
It should error
This is just a variant of what was fixed for one-level conditionals in #56004
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
π Search Terms
constraints conditional types type variables nested
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.7.0-dev.20240904#code/C4TwDgpgBAkgzgWQIbAMYAsCWA7A5gZWACcdcB5bCAGQgDcIAbAHgBUoIAPYCbAEzihxipAHxQAvFDadufAQAMkAEgDeQkngC+8gFBQoAfijEArhD1QAXFABmSBnAgBuHTpsnsqYJgD22WwBMTPjsXDz8gsJ4IgAUHNbwyGhYeIQa5JQ09Mz4IgCUUCoWDBDAxtam0JIcTlAA9HVQAKJERD5ExaW21nYOVVA19Y0tbR2arqCQsIgoGKRppCwA7j5ZjHCsobIR6qISUlvhCspqUbjaFkbSYXJQ8qq7WgBeuvr6RpUW+j32jhY-fRcbg8Xl8-hsAGZgodbo9cLF4tMknNUmdlqs6OtgvlCp0ysAKkQzPtBg1mq12njurZfv1SY0yABrKAAIxMZTg6B8JgYvFZ0CQ-ggFLGOiAA
π» Code
π Actual behavior
It doesn't error on the fourth assignment
π Expected behavior
It should error
Additional information about the issue
This is just a variant of what was fixed for one-level conditionals in #56004
The text was updated successfully, but these errors were encountered: