🔎 Search Terms
constraints conditional types type variables nested
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.7.0-dev.20240904#code/C4TwDgpgBAkgzgWQIbAMYAsCWA7A5gZWACcdcB5bCAGQgDcIAbAHgBUoIAPYCbAEzihxipAHxQAvFDadufAQAMkAEgDeQkngC+8gFBQoAfijEArhD1QAXFABmSBnAgBuHTpsnsqYJgD22WwBMTPjsXDz8gsJ4IgAUHNbwyGhYeIQa5JQ09Mz4IgCUUCoWDBDAxtam0JIcTlAA9HVQAKJERD5ExaW21nYOVVA19Y0tbR2arqCQsIgoGKRppCwA7j5ZjHCsobIR6qISUlvhCspqUbjaFkbSYXJQ8qq7WgBeuvr6RpUW+j32jhY-fRcbg8Xl8-hsAGZgodbo9cLF4tMknNUmdlqs6OtgvlCp0ysAKkQzPtBg1mq12njurZfv1SY0yABrKAAIxMZTg6B8JgYvFZ0CQ-ggFLGOiAA
💻 Code
typeIsMatchingStringOneLevel<Textendsstring>=Textends `a${string}`
? true
: false;functionf2<Sextendsstring>(x: IsMatchingStringOneLevel<S>){lett: true=x;// Errorletf: false=x;// Error}typeIsMatchingStringTwoLevels<Textendsstring>=Textends `a${string}`
? Textends `${string}z`
? true
: false
: false;functionf3<Sextendsstring>(x: IsMatchingStringTwoLevels<S>){lett: true=x;// Errorletf: false=x;// Ok but should be an error}🙁 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
🔎 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