Title: Types of property length are incompatible when extending tuple types. · Issue #20539 · microsoft/TypeScript · GitHub
Open Graph Title: Types of property length are incompatible when extending tuple types. · Issue #20539 · microsoft/TypeScript
X Title: Types of property length are incompatible when extending tuple types. · Issue #20539 · microsoft/TypeScript
Description: TypeScript Version: typescript@2.7.0-dev.20171207 Code type UnionizeTuple
Open Graph Description: TypeScript Version: typescript@2.7.0-dev.20171207 Code type UnionizeTuple
X Description: TypeScript Version: typescript@2.7.0-dev.20171207 Code type UnionizeTuple<T extends [any]> = T[number]; type a = ['hi', 'there'] type b = UnionizeTuple<a> Expected behav...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/20539
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Types of property length are incompatible when extending tuple types.","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\u003c!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n\u003c!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** typescript@2.7.0-dev.20171207\r\n\r\n**Code**\r\n\r\n```ts\r\ntype UnionizeTuple\u003cT extends [any]> = T[number];\r\ntype a = ['hi', 'there']\r\ntype b = UnionizeTuple\u003ca>\r\n```\r\n\r\n**Expected behavior:**\r\n```ts\r\nb === 'hi' | 'there'\r\n```\r\n\r\n**Actual behavior:**\r\n```\r\nType '[\"hi\", \"there\"]' does not satisfy the constraint '[any]'.\r\n Types of property 'length' are incompatible.\r\n Type '2' is not assignable to type '1'\r\n```\r\n\r\nThis is working as expected in all previous versions of typescript. Updated to the latest typescript@next this morning and this broke. I see why this happened, by being smarter about how we process tuples we can know at compile time the length of a tuple. But because there are not variadic kinds, there is no other way to accomplish the above (or much more complicated examples as I am using elsewhere).","author":{"url":"https://github.com/andnp","@type":"Person","name":"andnp"},"datePublished":"2017-12-07T15:22:07Z","url":"https://github.com/microsoft/TypeScript/issues/20539"}
| 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:ad08eb86-57a2-2591-3de7-4ae2e8d3bd13 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 911C:2DBB21:A0608C:D77474:6B00ED2A |
| html-safe-nonce | 0fd2492be9fd8414386c3a65ece55045df533ca0076f80746784cb4ed35f072a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTFDOjJEQkIyMTpBMDYwOEM6RDc3NDc0OjZCMDBFRDJBIiwidmlzaXRvcl9pZCI6IjQ4NjY0NTk5MzI1NzgzNDQyMzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 464677bd064f8ee17b2ec8f4a03925ac79bb3815048012b2e5c31cb78a44b947 |
| hovercard-subject-tag | issue:280168843 |
| 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/20539/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ae197e115cac1fb573dcb2cb296fee81ecb4ffd3f8768c156217f95dd19a349d/microsoft/TypeScript/issues/20539 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ae197e115cac1fb573dcb2cb296fee81ecb4ffd3f8768c156217f95dd19a349d/microsoft/TypeScript/issues/20539 |
| og:image:alt | TypeScript Version: typescript@2.7.0-dev.20171207 Code type UnionizeTuple |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | andnp |
| 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