Title: Spread arrays · Issue #237 · microsoft/TypeScript · GitHub
Open Graph Title: Spread arrays · Issue #237 · microsoft/TypeScript
X Title: Spread arrays · Issue #237 · microsoft/TypeScript
Description: Example from ES6 [1, 2, ...items, 3, ...moreItems] Type checking The type of the array is the best common type of the individual elements and the element types of each of the "spread" elements. Codegen [1, 2, ...items, 3, ...moreItems] b...
Open Graph Description: Example from ES6 [1, 2, ...items, 3, ...moreItems] Type checking The type of the array is the best common type of the individual elements and the element types of each of the "spread" elements. Cod...
X Description: Example from ES6 [1, 2, ...items, 3, ...moreItems] Type checking The type of the array is the best common type of the individual elements and the element types of each of the "spread" ele...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/237
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Spread arrays","articleBody":"### Example from ES6\n\n``` ts \n[1, 2, ...items, 3, ...moreItems]\n```\n### Type checking\n\nThe type of the array is the best common type of the individual elements and the element types of each of the \"spread\" elements.\n### Codegen\n\n``` ts\n[1, 2, ...items, 3, ...moreItems]\n```\n\nbecomes:\n\n``` js\n[1,2].concat(items, [3], moreItems)\n```\n\nIf the array starts with a spread, you can concat off the spread:\n\n``` ts\n[...items, 1, 2, ...moreItems]\n```\n\nbecomes:\n\n``` js\nitems.concat([1, 2], moreItems)\n```\n### Questions\n\n> What if it's 'any'? We don't know, so we have to codegen a slice. One possible issue is that .concat doesn't take array-like, it takes arrays only. This won't be a problem for spread arguments because .apply should take array-likes.\n","author":{"url":"https://github.com/RyanCavanaugh","@type":"Person","name":"RyanCavanaugh"},"datePublished":"2014-07-24T20:18:59Z","url":"https://github.com/microsoft/TypeScript/issues/237"}
| 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:8ffee0a6-9b58-9421-0ea8-be73d92c489a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E708:38C918:41F8CB:5C57DB:6B007208 |
| html-safe-nonce | 073d51497fe58c172c5198f9d2636e1a9192506c5b4bdda4e9056647759297b4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzA4OjM4QzkxODo0MUY4Q0I6NUM1N0RCOjZCMDA3MjA4IiwidmlzaXRvcl9pZCI6IjEwMjYxMjI5NTY0NDg3NTYyMzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b8535f60f159f90a2e7ff0e3287f47d8b61bd8c3e6902fc98a5369acbf4b53ba |
| hovercard-subject-tag | issue:38669799 |
| 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/237/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6d91f696020bbd3f5cd3c07972ef1043fd753c9dd4d49bf4b92621fb93f0d937/microsoft/TypeScript/issues/237 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6d91f696020bbd3f5cd3c07972ef1043fd753c9dd4d49bf4b92621fb93f0d937/microsoft/TypeScript/issues/237 |
| og:image:alt | Example from ES6 [1, 2, ...items, 3, ...moreItems] Type checking The type of the array is the best common type of the individual elements and the element types of each of the "spread" elements. Cod... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RyanCavanaugh |
| hostname | github.com |
| expected-hostname | github.com |
| None | 75c2b65dd205f26961d0c29afed1a8d0bb7cca9f05780571dfd1ef93eb539d16 |
| 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 | 84e563eb4b55f8fa102f325f117533cee9e3df4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width