Title: Nested Tagged Unions · Issue #18758 · microsoft/TypeScript · GitHub
Open Graph Title: Nested Tagged Unions · Issue #18758 · microsoft/TypeScript
X Title: Nested Tagged Unions · Issue #18758 · microsoft/TypeScript
Description: TypeScript Version: 2.5.2 Code type A = { type: "a", a: number } type B = { type: "b", b: number } type X = { type: A, a: string } type Y = { type: B, b: string } let x: X | Y if (x.type.type === "a") { x.a // Type Error } Expected behav...
Open Graph Description: TypeScript Version: 2.5.2 Code type A = { type: "a", a: number } type B = { type: "b", b: number } type X = { type: A, a: string } type Y = { type: B, b: string } let x: X | Y if (x.type.type === "...
X Description: TypeScript Version: 2.5.2 Code type A = { type: "a", a: number } type B = { type: "b", b: number } type X = { type: A, a: string } type Y = { type: B, b: string } let x: X | Y i...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/18758
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Nested Tagged Unions","articleBody":"\r\n**TypeScript Version:** 2.5.2\r\n\r\n**Code**\r\n\r\n```ts\r\ntype A = { type: \"a\", a: number }\r\ntype B = { type: \"b\", b: number }\r\n\r\ntype X = { type: A, a: string }\r\ntype Y = { type: B, b: string }\r\n\r\nlet x: X | Y\r\n\r\nif (x.type.type === \"a\") {\r\n\tx.a // Type Error\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nI would expect x to have type `X` inside the if-statement after disambiguating the nested tagged union types.\r\n\r\n**Actual behavior:**\r\n","author":{"url":"https://github.com/ccorcos","@type":"Person","name":"ccorcos"},"datePublished":"2017-09-26T01:17:13Z","url":"https://github.com/microsoft/TypeScript/issues/18758"}
| 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:3b771681-88e6-8775-f473-b7751b7b0b0a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDDE:157C65:AB5A8B:E5EA1F:6B00F191 |
| html-safe-nonce | 215fab98d339eab103a87bc4bba769c81fc8a2554362844662cfbe5757e64682 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRERFOjE1N0M2NTpBQjVBOEI6RTVFQTFGOjZCMDBGMTkxIiwidmlzaXRvcl9pZCI6Ijg4MjExMzY5OTk3ODEwMzY0MzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a689eaf8a2daa8f6e17731bac14b99e4f41d96efeb4e81efed7e2e57eb6c2d8d |
| hovercard-subject-tag | issue:260461066 |
| 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/18758/issue_layout |
| twitter:image | https://opengraph.githubassets.com/166a2ed8fd706af311b7e6910c688fa373d34dda4d7a6f88ed7a4c3c63a768f1/microsoft/TypeScript/issues/18758 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/166a2ed8fd706af311b7e6910c688fa373d34dda4d7a6f88ed7a4c3c63a768f1/microsoft/TypeScript/issues/18758 |
| og:image:alt | TypeScript Version: 2.5.2 Code type A = { type: "a", a: number } type B = { type: "b", b: number } type X = { type: A, a: string } type Y = { type: B, b: string } let x: X | Y if (x.type.type === "... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ccorcos |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width