Title: It is possible to violate generic constraints when distributing union types · Issue #63708 · microsoft/TypeScript · GitHub
Open Graph Title: It is possible to violate generic constraints when distributing union types · Issue #63708 · microsoft/TypeScript
X Title: It is possible to violate generic constraints when distributing union types · Issue #63708 · microsoft/TypeScript
Description: 🔎 Search Terms constraint, conditional, distributive, distributed, distribution 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about "constraint" ⏯ Playground Link htt...
Open Graph Description: 🔎 Search Terms constraint, conditional, distributive, distributed, distribution 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries ...
X Description: 🔎 Search Terms constraint, conditional, distributive, distributed, distribution 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entr...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/63708
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"It is possible to violate generic constraints when distributing union types","articleBody":"### 🔎 Search Terms\n\nconstraint, conditional, distributive, distributed, distribution\n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _\"constraint\"_\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play/?#code/C4TwDgpgBAkgznArhAPAQQDRQEJQgD2AgDsATOKNAPigF5K9CTypFiBrYgewHdiAoKFAD8ORkTIU2nXgKFDRAZQAWvdFmxVB8gFxRiEAG4QATtr0HjJgNz9+oSFBVrMYghJbU6UANqvsALpQAGRQAN4Avrb24NAAGt7wSKgADFAAPlAAjFhpmVlUtkA\n\n### 💻 Code\n\n```ts\ntype Issue\u003cA, B extends A> = A extends unknown\n ? B extends unknown\n ? Show\u003cA, B>\n : never\n : never;\n\ntype Show\u003cA, B extends A> = [A, B] & {};\n\ntype X = Issue\u003c0 | 1, 0 | 1>;\n```\n\n\n### 🙁 Actual behavior\n\n`X` is evaluated to `[0, 0] | [0, 1] | [1, 0] | [1, 1]`.\n\nNo errors are reported despite the `[0, 1] | [1, 0]` part resulting from the evaluation of `Show\u003c0, 1>` and `Show\u003c1, 0>` which should not be allowed because of the `B extends A` constraint.\n\n### 🙂 Expected behavior\n\nAn error is reported on line 3, saying the constraint might be violated.\n\n### Additional information about the issue\n\nThis is how the type should actually be implemented:\n\n```ts\ntype Issue\u003cA, B extends A> = A extends unknown\n ? B extends A\n ? Show\u003cA, B> // only B members that extend the current A member reach this line\n : never\n : never;\n```","author":{"url":"https://github.com/aweebit","@type":"Person","name":"aweebit"},"datePublished":"2026-08-02T01:44:47Z","url":"https://github.com/microsoft/TypeScript/issues/63708"}
| 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:a9db7b59-4319-7101-1111-fc797f442e52 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B5CE:269AD9:FFED8A:1568ECF:6B01123B |
| html-safe-nonce | c2e2b115ac7567addb1110ab0c8368b2339346c6a89639089c8ab11ec11b85b6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUNFOjI2OUFEOTpGRkVEOEE6MTU2OEVDRjo2QjAxMTIzQiIsInZpc2l0b3JfaWQiOiIyMjk3NTE5NDkwNTc3NjY5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 977fdac458a205a66db7ce9f32d9173f17df0e405dd7099eb5e9d0d6dec68bd5 |
| hovercard-subject-tag | issue:5040035255 |
| 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/63708/issue_layout |
| twitter:image | https://opengraph.githubassets.com/31da8f447b2a939c7c6a639dba38ec30f01b33e5fdab4fed7c3dd3eb7cf8d18f/microsoft/TypeScript/issues/63708 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/31da8f447b2a939c7c6a639dba38ec30f01b33e5fdab4fed7c3dd3eb7cf8d18f/microsoft/TypeScript/issues/63708 |
| og:image:alt | 🔎 Search Terms constraint, conditional, distributive, distributed, distribution 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aweebit |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width