Title: Spread types may only be created from object types · Issue #14409 · microsoft/TypeScript · GitHub
Open Graph Title: Spread types may only be created from object types · Issue #14409 · microsoft/TypeScript
X Title: Spread types may only be created from object types · Issue #14409 · microsoft/TypeScript
Description: Version 2.2.1 let p = {} as any as object; const z = { ...p } // works fine const fn =
Open Graph Description: Version 2.2.1 let p = {} as any as object; const z = { ...p } // works fine const fn =
X Description: Version 2.2.1 let p = {} as any as object; const z = { ...p } // works fine const fn = <T extends object>(t: T) => { return { ...t } // Error: Spread types may only be created from object ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/14409
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Spread types may only be created from object types","articleBody":"Version 2.2.1\r\n\r\n``` ts\r\nlet p = {} as any as object;\r\nconst z = { ...p } // works fine\r\nconst fn = \u003cT extends object>(t: T) => {\r\n\treturn { ...t } // Error: Spread types may only be created from object types.\r\n}\r\n```\r\n\r\nShould this be erroring?","author":{"url":"https://github.com/OliverJAsh","@type":"Person","name":"OliverJAsh"},"datePublished":"2017-03-02T11:49:40Z","url":"https://github.com/microsoft/TypeScript/issues/14409"}
| 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:dd964d48-f662-ef6b-7d62-9520bae07eaa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 888E:EA09B:2C2556D:3A8CCA9:6B01C6A3 |
| html-safe-nonce | fabafbfd3fe6c7d37948b02d66da3b42d3ec6ca80ad370cd5c965222bead4fe0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODhFOkVBMDlCOjJDMjU1NkQ6M0E4Q0NBOTo2QjAxQzZBMyIsInZpc2l0b3JfaWQiOiI3ODcyODc2NjUyNTM4MjE4MTQ3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5a3600d3daef78e5f6efec8fb4295b9236b8051ce7f8394ff855394ee3bfa4e8 |
| hovercard-subject-tag | issue:211368646 |
| 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/14409/issue_layout |
| twitter:image | https://opengraph.githubassets.com/241f166fef5a7ca3499b1d0aa5d38e7c562f5add0e7e0be5124c463306feae06/microsoft/TypeScript/issues/14409 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/241f166fef5a7ca3499b1d0aa5d38e7c562f5add0e7e0be5124c463306feae06/microsoft/TypeScript/issues/14409 |
| og:image:alt | Version 2.2.1 let p = {} as any as object; const z = { ...p } // works fine const fn = |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | OliverJAsh |
| 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 |
Links:
Viewport: width=device-width