Title: Constraints of nested conditional types applied to constrained type variables are incorrect · Issue #59868 · microsoft/TypeScript · GitHub
Open Graph Title: Constraints of nested conditional types applied to constrained type variables are incorrect · Issue #59868 · microsoft/TypeScript
X Title: Constraints of nested conditional types applied to constrained type variables are incorrect · Issue #59868 · microsoft/TypeScript
Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Constraints of nested conditional types applied to constrained type variables are incorrect · Issue #59868 · microsoft/TypeScript
Open Graph Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Constraints of nested conditional types applied to constrained type variables are incorrect · Issue #59868 · micro...
X Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Constraints of nested conditional types applied to constrained type variables are incorrect · Issue #59868 · micro...
Opengraph URL: https://github.com/microsoft/TypeScript
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Constraints of nested conditional types applied to constrained type variables are incorrect","articleBody":"### 🔎 Search Terms\n\nconstraints conditional types type variables nested\n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play/?ts=5.7.0-dev.20240904#code/C4TwDgpgBAkgzgWQIbAMYAsCWA7A5gZWACcdcB5bCAGQgDcIAbAHgBUoIAPYCbAEzihxipAHxQAvFDadufAQAMkAEgDeQkngC+8gFBQoAfijEArhD1QAXFABmSBnAgBuHTpsnsqYJgD22WwBMTPjsXDz8gsJ4IgAUHNbwyGhYeIQa5JQ09Mz4IgCUUCoWDBDAxtam0JIcTlAA9HVQAKJERD5ExaW21nYOVVA19Y0tbR2arqCQsIgoGKRppCwA7j5ZjHCsobIR6qISUlvhCspqUbjaFkbSYXJQ8qq7WgBeuvr6RpUW+j32jhY-fRcbg8Xl8-hsAGZgodbo9cLF4tMknNUmdlqs6OtgvlCp0ysAKkQzPtBg1mq12njurZfv1SY0yABrKAAIxMZTg6B8JgYvFZ0CQ-ggFLGOiAA\n\n### 💻 Code\n\n```ts\r\ntype IsMatchingStringOneLevel\u003cT extends string> = T extends `a${string}`\r\n ? true\r\n : false;\r\n\r\nfunction f2\u003cS extends string>(x: IsMatchingStringOneLevel\u003cS>) {\r\n let t: true = x; // Error\r\n let f: false = x; // Error\r\n}\r\n\r\ntype IsMatchingStringTwoLevels\u003cT extends string> = T extends `a${string}`\r\n ? T extends `${string}z`\r\n ? true\r\n : false\r\n : false;\r\n\r\nfunction f3\u003cS extends string>(x: IsMatchingStringTwoLevels\u003cS>) {\r\n let t: true = x; // Error\r\n let f: false = x; // Ok but should be an error\r\n}\r\n```\r\n\n\n### 🙁 Actual behavior\n\nIt doesn't error on the fourth assignment\n\n### 🙂 Expected behavior\n\nIt should error\n\n### Additional information about the issue\n\nThis is just a variant of what was fixed for one-level conditionals in https://github.com/microsoft/TypeScript/pull/56004","author":{"url":"https://github.com/Andarist","@type":"Person","name":"Andarist"},"datePublished":"2024-09-05T13:52:06Z","url":"https://github.com/microsoft/TypeScript/issues/59868"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:a5ce4a51-5de0-05fc-2002-b0bcebe3a212 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 858E:9C505:22D3DB:2EC729:6B04E849 |
| html-safe-nonce | be03dce2b61ba0d40ccb0fae7af33ba2383573df0ebfd6e225102333b776f802 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NThFOjlDNTA1OjIyRDNEQjoyRUM3Mjk6NkIwNEU4NDkiLCJ2aXNpdG9yX2lkIjoiNTc0MjE3NTYxNTAxNzM0NzE0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d235226d4b63d2b8dfae265fba0e11c4a987b28761188f44bd68011e0e3f83a6 |
| hovercard-subject-tag | repository:20929025 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/microsoft/TypeScript/issues/59868 |
| twitter:image | https://opengraph.githubassets.com/402d184bb22693ddcb7a7f5687b91d0dede640161220a1b4e4a4c900297217ae/microsoft/TypeScript |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/402d184bb22693ddcb7a7f5687b91d0dede640161220a1b4e4a4c900297217ae/microsoft/TypeScript |
| og:image:alt | TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Constraints of nested conditional types applied to constrained type variables are incorrect · Issue #59868 · micro... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | f3851aad500d8e8dce736722ddc6fa9596e17d9fce3c53581eba968664c0bc32 |
| turbo-cache-control | no-cache |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e29c922455fd8137f27e1cfcdf6a1e8b920b1926 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width