Title: Regression in 2.9+: expansion of type operator is incorrect · Issue #24640 · microsoft/TypeScript · GitHub
Open Graph Title: Regression in 2.9+: expansion of type operator is incorrect · Issue #24640 · microsoft/TypeScript
X Title: Regression in 2.9+: expansion of type operator is incorrect · Issue #24640 · microsoft/TypeScript
Description: TypeScript Version: 2.9.1, 3.0.0-dev.20180602 Search Terms: conditional union type operator expansion Code type U = | { tag: 'a'; foo: number; f(): void; } | { tag: 'b'; bar: boolean; g(): void; }; type FilterUnion Open Graph Description: TypeScript Version: 2.9.1, 3.0.0-dev.20180602 Search Terms: conditional union type operator expansion Code type U = | { tag: 'a'; foo: number; f(): void; } | { tag: 'b'; bar: boolean; g(): void; };...
X Description: TypeScript Version: 2.9.1, 3.0.0-dev.20180602 Search Terms: conditional union type operator expansion Code type U = | { tag: 'a'; foo: number; f(): void; } | { tag: 'b'; bar: boolea...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/24640
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression in 2.9+: expansion of type operator is incorrect","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 2.9.1, 3.0.0-dev.20180602\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** conditional union type operator expansion\r\n\r\n**Code**\r\n\r\n```ts\r\ntype U =\r\n | {\r\n tag: 'a';\r\n foo: number;\r\n f(): void;\r\n }\r\n | {\r\n tag: 'b';\r\n bar: boolean;\r\n g(): void;\r\n };\r\n\r\ntype FilterUnion\u003cT extends { tag: string }, K> = T extends { tag: K } ? T : never;\r\ntype StripFunctions\u003cT> = Pick\u003c\r\n T,\r\n { [K in keyof T]: T[K] extends (...args: any[]) => any ? never : K }[keyof T]\r\n>;\r\ntype FilterAndStrip\u003cK extends U['tag']> = StripFunctions\u003cFilterUnion\u003cU, K>>;\r\n\r\ntype X1 = FilterAndStrip\u003c'a'>;\r\ntype X2 = StripFunctions\u003cFilterUnion\u003cU, 'a'>>;\r\n```\r\n\r\n**Expected behavior:**\r\n`X1` and `X2` should both have the type `{ tag: 'a'; foo: number }`, since the latter is just an expansion of the first.\r\n\r\n**Actual behavior:**\r\n\r\n`X2` is correct, but `X1: {}`.\r\n\r\n[**Playground Link**](http://www.typescriptlang.org/play/#src=type%20U%20%3D%0A%20%20%7C%20%7B%0A%20%20%20%20%20%20tag%3A%20'a'%3B%0A%20%20%20%20%20%20foo%3A%20number%3B%0A%20%20%20%20%20%20f()%3A%20void%3B%0A%20%20%20%20%7D%0A%20%20%7C%20%7B%0A%20%20%20%20%20%20tag%3A%20'b'%3B%0A%20%20%20%20%20%20bar%3A%20boolean%3B%0A%20%20%20%20%20%20g()%3A%20void%3B%0A%20%20%20%20%7D%3B%0A%0Atype%20FilterUnion%3CT%20extends%20%7B%20tag%3A%20string%20%7D%2C%20K%3E%20%3D%20T%20extends%20%7B%20tag%3A%20K%20%7D%20%3F%20T%20%3A%20never%3B%0Atype%20StripFunctions%3CT%3E%20%3D%20Pick%3C%0A%20%20T%2C%0A%20%20%7B%20%5BK%20in%20keyof%20T%5D%3A%20T%5BK%5D%20extends%20(...args%3A%20any%5B%5D)%20%3D%3E%20any%20%3F%20never%20%3A%20K%20%7D%5Bkeyof%20T%5D%0A%3E%3B%0Atype%20FilterAndStrip%3CK%20extends%20U%5B'tag'%5D%3E%20%3D%20StripFunctions%3CFilterUnion%3CU%2C%20K%3E%3E%3B%0A%0Atype%20X1%20%3D%20FilterAndStrip%3C'a'%3E%3B%0Atype%20X2%20%3D%20StripFunctions%3CFilterUnion%3CU%2C%20'a'%3E%3E%3B)\r\n\r\n","author":{"url":"https://github.com/pelotom","@type":"Person","name":"pelotom"},"datePublished":"2018-06-03T22:10:38Z","url":"https://github.com/microsoft/TypeScript/issues/24640"}
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:69d93915-2a9c-507d-ff6d-d1317d127d33 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id 8100:DB09F:2C10836:383F5FF:6B01BBFD html-safe-nonce fb9489c2580fe8bff91af8b4ba2865284307a6cbdba09bd82700a11938b2c62b visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTAwOkRCMDlGOjJDMTA4MzY6MzgzRjVGRjo2QjAxQkJGRCIsInZpc2l0b3JfaWQiOiI1NjkyODU4OTUzNjg4NTI5OTE3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= visitor-hmac 5b4659c99d663b37e3ea462fe8806761d382ced4306e00f3c3b6530c1ffc9183 hovercard-subject-tag issue:328866760 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/24640/issue_layout twitter:image https://opengraph.githubassets.com/e43f5f9abb09c19fa53ea762c68e905d59e7864187334b4f681676ae3683771c/microsoft/TypeScript/issues/24640 twitter:card summary_large_image og:image https://opengraph.githubassets.com/e43f5f9abb09c19fa53ea762c68e905d59e7864187334b4f681676ae3683771c/microsoft/TypeScript/issues/24640 og:image:alt TypeScript Version: 2.9.1, 3.0.0-dev.20180602 Search Terms: conditional union type operator expansion Code type U = | { tag: 'a'; foo: number; f(): void; } | { tag: 'b'; bar: boolean; g(): void; };... og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username pelotom hostname github.com expected-hostname github.com None cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c 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 8c77c9e8439031ad54c75a250694842892f693e1 ui-target full theme-color #1e2327 color-scheme light dark react-app-name issues
URLs of crawlers that visited me.