Title: Type inference doesn't work with union types of tuples · Issue #22564 · microsoft/TypeScript · GitHub
Open Graph Title: Type inference doesn't work with union types of tuples · Issue #22564 · microsoft/TypeScript
X Title: Type inference doesn't work with union types of tuples · Issue #22564 · microsoft/TypeScript
Description: separated from #22432 TypeScript Version: 2.7.0-dev.20180307 Search Terms: Code type A
Open Graph Description: separated from #22432 TypeScript Version: 2.7.0-dev.20180307 Search Terms: Code type A
X Description: separated from #22432 TypeScript Version: 2.7.0-dev.20180307 Search Terms: Code type A<R> = [R] | [R, string]; declare function f<T>(f: A<T>): void; f([undefined, ''] as [...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/22564
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type inference doesn't work with union types of tuples","articleBody":"separated from #22432\r\n\r\n**TypeScript Version:** 2.7.0-dev.20180307\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** \r\n\r\n**Code**\r\n\r\n```ts\r\ntype A\u003cR> = [R] | [R, string];\r\ndeclare function f\u003cT>(f: A\u003cT>): void;\r\nf([undefined, ''] as [never, string]); // T: string\r\nf([undefined, ''] as [void, string]); // T: string | void\r\n```\r\n\r\n**Expected behavior:**\r\n\r\n```ts\r\nf([undefined, ''] as [never, string]); // T: never\r\nf([undefined, ''] as [void, string]); // T: void\r\n```\r\n\r\n**Actual behavior:**\r\n\r\n```ts\r\nf([undefined, ''] as [never, string]); // T: string\r\nf([undefined, ''] as [void, string]); // T: string | void\r\n```\r\n\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior --> \r\n\r\n**Related Issues:**\r\n","author":{"url":"https://github.com/falsandtru","@type":"Person","name":"falsandtru"},"datePublished":"2018-03-14T09:37:30Z","url":"https://github.com/microsoft/TypeScript/issues/22564"}
| 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:e2262afa-a871-e744-b85e-f47614cff759 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B640:33444D:B1239E:ED05CD:6B00F21E |
| html-safe-nonce | 7c80667016cc2003e9630d217e9b2c32262204f78e96f627f77d2a88cba1d272 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjQwOjMzNDQ0RDpCMTIzOUU6RUQwNUNEOjZCMDBGMjFFIiwidmlzaXRvcl9pZCI6IjcxOTg0OTU1NzIyMTM0Mjg3NjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4b402846989ac879a0a1dcfb98d7ea0ddb6686f151c8af5d2bc47f154243a13a |
| hovercard-subject-tag | issue:305083566 |
| 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/22564/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0e51b91c8e376826e3da12a37d1e0c095609b4d820e3effcc3e2b8652b41002a/microsoft/TypeScript/issues/22564 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0e51b91c8e376826e3da12a37d1e0c095609b4d820e3effcc3e2b8652b41002a/microsoft/TypeScript/issues/22564 |
| og:image:alt | separated from #22432 TypeScript Version: 2.7.0-dev.20180307 Search Terms: Code type A |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | falsandtru |
| 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