Title: Regression: intersection of a generic type bound to a discriminated union with one of the union constituencies reduces to never · Issue #38549 · microsoft/TypeScript · GitHub
Open Graph Title: Regression: intersection of a generic type bound to a discriminated union with one of the union constituencies reduces to never · Issue #38549 · microsoft/TypeScript
X Title: Regression: intersection of a generic type bound to a discriminated union with one of the union constituencies reduces to never · Issue #38549 · microsoft/TypeScript
Description: TypeScript Version: 3.9.2 Search Terms: Generic union intersection Code interface A { kind: "A"; a: number; } interface B { kind: "B"; b: number; } declare const shouldBeB: (A | B) & B; const b: B = shouldBeB; // works function inGeneric...
Open Graph Description: TypeScript Version: 3.9.2 Search Terms: Generic union intersection Code interface A { kind: "A"; a: number; } interface B { kind: "B"; b: number; } declare const shouldBeB: (A | B) & B; const b: B ...
X Description: TypeScript Version: 3.9.2 Search Terms: Generic union intersection Code interface A { kind: "A"; a: number; } interface B { kind: "B"; b: number; } declare const shouldBeB: (A |...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/38549
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression: intersection of a generic type bound to a discriminated union with one of the union constituencies reduces to never","articleBody":"**TypeScript Version:** 3.9.2\r\n\r\n**Search Terms:** Generic union intersection\r\n\r\n**Code**\r\n\r\n```ts\r\ninterface A {\r\n kind: \"A\";\r\n a: number;\r\n}\r\n\r\ninterface B {\r\n kind: \"B\";\r\n b: number;\r\n}\r\n\r\ndeclare const shouldBeB: (A | B) & B;\r\nconst b: B = shouldBeB; // works\r\n\r\nfunction inGeneric\u003cT extends A | B>(alsoShouldBeB: T & B) {\r\n const b: B = alsoShouldBeB;\r\n // ~ TS2739: Type 'T & B' is missing the following properties from type 'B': kind, b\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nNo errors (were no errors on 3.8)\r\n\r\n**Actual behavior:**\r\n\r\n```\r\nTS2739: Type 'T & B' is missing the following properties from type 'B': kind, b\r\n```\r\n\r\n**Playground Link:** [link](https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=18&pc=1#code/JYOwLgpgTgZghgYwgAgILIN4FgBQzkDWoAJgFzIBEqFA3LvnOSAK4C2ARtHTgL666hIsRCgBCmeoRLkKo2pPZM2nKNz45cxCAgA2cKCgQB7EAGcwyUwAsjzHcVERR5ABToAPslEBKZADIvbmMzC0UvZABeSxs7BycaZAB6ROQAdyMoAlN+HBhmEAQwYBNkUABxCBBoYAQAHgAVZAgAD0gQYlM0ZE9RAD4XOB1TIwBlGPtHZ2RGgJ8JPGRg82Qw8SjB4bHbCfjJZPx8AD9pkYAmAHYAZgBOcnqATwAHFAByGa8X0s7WYFNTUAA5sgwFYUDAjDodEZUoDkI8oEZnlAihBOjAEaxgU9XqIXuQiO0ADQrXDqIA)\r\n\r\n**Related Issues:**\r\n\r\nIt seems to be related to #36696","author":{"url":"https://github.com/Igorbek","@type":"Person","name":"Igorbek"},"datePublished":"2020-05-13T16:32:27Z","url":"https://github.com/microsoft/TypeScript/issues/38549"}
| 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:7879fd7a-f7be-bfa3-094e-f4a859b461f8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EE42:213839:DFEEB9:12148F1:6B00F801 |
| html-safe-nonce | 44fa27b032972ccc9ee41f25cb5003a390e98069da450eb27b1eb35df9baa236 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTQyOjIxMzgzOTpERkVFQjk6MTIxNDhGMTo2QjAwRjgwMSIsInZpc2l0b3JfaWQiOiI1MjQwNTU5MTgxODU3MDkzNjMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cfd501994ba7d4826a58ea8d02f234756f3be9c01493933513e46b6064541522 |
| hovercard-subject-tag | issue:617590736 |
| 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/38549/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6925c1c7f6753fd26a3b1bc3dbff9e3d60b3e91a9fdf587d669ce754effb26e6/microsoft/TypeScript/issues/38549 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6925c1c7f6753fd26a3b1bc3dbff9e3d60b3e91a9fdf587d669ce754effb26e6/microsoft/TypeScript/issues/38549 |
| og:image:alt | TypeScript Version: 3.9.2 Search Terms: Generic union intersection Code interface A { kind: "A"; a: number; } interface B { kind: "B"; b: number; } declare const shouldBeB: (A | B) & B; const b: B ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Igorbek |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| 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 | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width