Title: Generic conditional type prematurely resolves to one of the branches instead of deferring · Issue #57650 · microsoft/TypeScript · GitHub
Open Graph Title: Generic conditional type prematurely resolves to one of the branches instead of deferring · Issue #57650 · microsoft/TypeScript
X Title: Generic conditional type prematurely resolves to one of the branches instead of deferring · Issue #57650 · microsoft/TypeScript
Description: 🔎 Search Terms generic, conditional, premature / eager / defer, inline, 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about generic conditional types ⏯ Playground Lin...
Open Graph Description: 🔎 Search Terms generic, conditional, premature / eager / defer, inline, 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about ge...
X Description: 🔎 Search Terms generic, conditional, premature / eager / defer, inline, 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries abou...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/57650
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generic conditional type prematurely resolves to one of the branches instead of deferring","articleBody":"### 🔎 Search Terms\n\ngeneric, conditional, premature / eager / defer, inline, \n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried, and I reviewed the FAQ for entries about generic conditional types \n\n### ⏯ Playground Link\n\n[Playground link](https://www.typescriptlang.org/play?#code/C4TwDgpgBAkgzgOQK4FsBGEBOAeAKgPigF4oBtXAXSggA9gIA7AEzjIdQ0yoH4phMk0AFxQAZgEMANnAgAoUJFhwAYlJl5qdRiyhoA9nskRxDQiQnSIpKrXrNWua1F79BUERZmz54aABEAS0wIAGNgYiVVS2x4ZHQsbDh+AIYAc3xCW21WV2heAAZ3KABGAG5ZAHoKqBqAPW5vBWgAZQALPUxgEKRgPDNItQgYxA4Egkytez4BPKhCkTKfRRhmINDwkjaOrp7E5LT8cqqaqHrvWSA)\n\n### 💻 Code\n\n```ts\r\ntype IsNumber\u003cT> = [T] extends [number] ? true : false\r\ntype IsFalse\u003cT extends boolean> = false[] extends T[] ? true : false\r\n\r\ntype Direct = IsFalse\u003cIsNumber\u003cstring>> extends true ? 0 : 1;\r\n// ^? type Direct = 0\r\n\r\ntype Shortcut\u003cT> = IsFalse\u003cIsNumber\u003cT>> extends true ? 0 : 1;\r\ntype Indirect = Shortcut\u003cstring>;\r\n// ^? type Indirect = 1\r\n\r\n```\r\n\n\n### 🙁 Actual behavior\n\n`Direct` and `Indirect` are different.\n\n### 🙂 Expected behavior\n\n`Direct` and `Indirect` should be the same because `Direct` is just an inlined version of `Shortcut\u003cstring>`.\n\n### Additional information about the issue\n\nThis feels like a similar issue to #39364, #30708, #30020 and maybe some others, but many of those have been resolved already and yet this one remains. Came from [this Stack Overflow question](https://stackoverflow.com/q/78104909/2887218).","author":{"url":"https://github.com/jcalz","@type":"Person","name":"jcalz"},"datePublished":"2024-03-05T14:50:00Z","url":"https://github.com/microsoft/TypeScript/issues/57650"}
| 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 | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:87d5b6db-1afc-301a-1ec8-8403edf2bc7d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 955C:21890A:275B91:32C73A:6B04F110 |
| html-safe-nonce | df9a6cca779f3432563b1ca73dffb4eda2737e54d857d7cc39648f46c17ba8e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTVDOjIxODkwQToyNzVCOTE6MzJDNzNBOjZCMDRGMTEwIiwidmlzaXRvcl9pZCI6IjY0MDU4NjM0OTgwODUzNjM5ODQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4dd13994f9d0cc02df9d9b66de48865d515898fd7b6f649a012b4d508ff787a3 |
| hovercard-subject-tag | issue:2169432746 |
| 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/_view_fragments/issues/show/microsoft/TypeScript/57650/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ff47bb7eaea387d1f487e9cfc23e268fa5563295c7a1820ced49fe7c36bc3a46/microsoft/TypeScript/issues/57650 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ff47bb7eaea387d1f487e9cfc23e268fa5563295c7a1820ced49fe7c36bc3a46/microsoft/TypeScript/issues/57650 |
| og:image:alt | 🔎 Search Terms generic, conditional, premature / eager / defer, inline, 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about ge... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jcalz |
| hostname | github.com |
| expected-hostname | github.com |
| None | c0ff704de2671f716381d0ef36115cddb81606dd5397a5b003230bb8c02d623b |
| turbo-cache-control | no-preview |
| 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 | cbe60d43d23e17438879ed212ad20068394651c4 |
| 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