Title: Tuple types and map · Issue #6574 · microsoft/TypeScript · GitHub
Open Graph Title: Tuple types and map · Issue #6574 · microsoft/TypeScript
X Title: Tuple types and map · Issue #6574 · microsoft/TypeScript
Description: I have a piece of code with many foo[]s that should really be [foo,foo] -- it would be nicer if map had a type that preserves tuples, so something like this: var x: [number, number]; x = [1,2].map(x=>x+1); would work, even if it's some h...
Open Graph Description: I have a piece of code with many foo[]s that should really be [foo,foo] -- it would be nicer if map had a type that preserves tuples, so something like this: var x: [number, number]; x = [1,2].map(...
X Description: I have a piece of code with many foo[]s that should really be [foo,foo] -- it would be nicer if map had a type that preserves tuples, so something like this: var x: [number, number]; x = [1,2].map(...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/6574
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tuple types and map","articleBody":"I have a piece of code with many `foo[]`s that should really be `[foo,foo]` -- it would be nicer if `map` had a type that preserves tuples, so something like this:\n\n```\nvar x: [number, number];\nx = [1,2].map(x=>x+1);\n```\n\nwould work, even if it's some hack with a union of tuples up to some number of elements (I think that I saw something like that around rest arguments, and I imagine that this in a close neighborhood).\n\nI thought that this would be common, but didn't find anything about it. Feel free to dismiss if it is.\n","author":{"url":"https://github.com/elbarzil","@type":"Person","name":"elbarzil"},"datePublished":"2016-01-22T18:18:58Z","url":"https://github.com/microsoft/TypeScript/issues/6574"}
| 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:5b155c32-4f2d-8aae-2229-9097e37c8188 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9ABE:3F8AB1:BAC86C:F10A17:6B00E942 |
| html-safe-nonce | 187eebd7d2c9cab9f9d9b928655425d0553535bd41c1cd2baa64851aaa0ea22e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QUJFOjNGOEFCMTpCQUM4NkM6RjEwQTE3OjZCMDBFOTQyIiwidmlzaXRvcl9pZCI6IjY0MzQ0MDIzMjIwODg1MzMxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bc9194acde54cf8c471603442cd7add7f59d770b29eb8092b8023532f1639777 |
| hovercard-subject-tag | issue:128212896 |
| 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/6574/issue_layout |
| twitter:image | https://opengraph.githubassets.com/44ae470997e0205d115b5f7ee60254d17c941248fdbc97dd7862e13ffd28c0fd/microsoft/TypeScript/issues/6574 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/44ae470997e0205d115b5f7ee60254d17c941248fdbc97dd7862e13ffd28c0fd/microsoft/TypeScript/issues/6574 |
| og:image:alt | I have a piece of code with many foo[]s that should really be [foo,foo] -- it would be nicer if map had a type that preserves tuples, so something like this: var x: [number, number]; x = [1,2].map(... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | elbarzil |
| 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