Title: Object spread and enumerable properties · Issue #13148 · microsoft/TypeScript · GitHub
Open Graph Title: Object spread and enumerable properties · Issue #13148 · microsoft/TypeScript
X Title: Object spread and enumerable properties · Issue #13148 · microsoft/TypeScript
Description: Hi :) EDIT: As noted by Aluan Haddad (@aluanhaddad), the bug is related to the combination of the shorthand syntax in a literal object and the object spread operator on this object. TypeScript Version: 2.1.4 Code First code (compilation ...
Open Graph Description: Hi :) EDIT: As noted by Aluan Haddad (@aluanhaddad), the bug is related to the combination of the shorthand syntax in a literal object and the object spread operator on this object. TypeScript Vers...
X Description: Hi :) EDIT: As noted by Aluan Haddad (@aluanhaddad), the bug is related to the combination of the shorthand syntax in a literal object and the object spread operator on this object. TypeScript Vers...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/13148
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Object spread and enumerable properties","articleBody":"Hi :)\r\n\r\nEDIT:\r\nAs noted by @aluanhaddad, the bug is related to the combination of the shorthand syntax in a literal object and the object spread operator on this object.\r\n\r\n**TypeScript Version:** 2.1.4\r\n\r\n**Code**\r\n\r\nFirst code (compilation success):\r\n```ts\r\ninterface I \u003cT> {\r\n f (): void\r\n g (): void\r\n}\r\nconst a = {\r\n f \u003cT> (this: I\u003cT>): void {}\r\n}\r\nconst b: I\u003cany> = Object.assign({\r\n g (): void {}\r\n}, a)\r\n```\r\n\r\nReplacement for last 3 lines (compilation failing):\r\n```ts\r\nconst b: I\u003cany> = {\r\n ...a,\r\n g (): void {}\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nReplace ```Object.assign``` with the object spread operator should not be harmful.\r\n\r\n**Actual behavior:**\r\n\r\nThe first code makes happy the compiler.\r\nHowever if I I replace ```Object.assign``` with the object spread operator (See replacement code), the compiler raises the next error:\r\n\r\n```\r\nerror TS2322: Type '{ g(): void; }' is not assignable to type 'I\u003cany>'.\r\n Property 'f' is missing in type '{ g(): void; }'.\r\n```","author":{"url":"https://github.com/Conaclos","@type":"Person","name":"Conaclos"},"datePublished":"2016-12-23T14:50:17Z","url":"https://github.com/microsoft/TypeScript/issues/13148"}
| 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:b2fc42ab-7fc9-93e5-3060-1618b3a6fee3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C106:1148D3:2BC20A8:37D4007:6B01B6B6 |
| html-safe-nonce | 9ee4786fc40731c9109bfce6a1779734ec70bd7de304843ef3be64f0c2860e1c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTA2OjExNDhEMzoyQkMyMEE4OjM3RDQwMDc6NkIwMUI2QjYiLCJ2aXNpdG9yX2lkIjoiMzg2OTc2NTk1NjM5ODA2OTQzMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9ead3aea0fc591b47bb212e38d1b2e2ddc5cc6452cd91c73235fe346c56af78c |
| hovercard-subject-tag | issue:197381319 |
| 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/13148/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ba4932fd093fc2d8de922c17eaffa1bc14ad4fdb41f3fefa70ab3a360be5ad63/microsoft/TypeScript/issues/13148 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ba4932fd093fc2d8de922c17eaffa1bc14ad4fdb41f3fefa70ab3a360be5ad63/microsoft/TypeScript/issues/13148 |
| og:image:alt | Hi :) EDIT: As noted by Aluan Haddad (@aluanhaddad), the bug is related to the combination of the shorthand syntax in a literal object and the object spread operator on this object. TypeScript Vers... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Conaclos |
| 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