Title: Widen intersections produced by spead expressions in object literals · Issue #29081 · microsoft/TypeScript · GitHub
Open Graph Title: Widen intersections produced by spead expressions in object literals · Issue #29081 · microsoft/TypeScript
X Title: Widen intersections produced by spead expressions in object literals · Issue #29081 · microsoft/TypeScript
Description: TypeScript Version: 3.3.0-dev Code function test
Open Graph Description: TypeScript Version: 3.3.0-dev Code function test
X Description: TypeScript Version: 3.3.0-dev Code function test<T extends { a: string, b: string }>(obj: T): T { let { a, ...rest } = obj; return { a: 'hello', ...rest } as T; // Error, but shouldn&...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/29081
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Widen intersections produced by spead expressions in object literals","articleBody":"**TypeScript Version:** 3.3.0-dev\r\n\r\n**Code**\r\n\r\n```ts\r\nfunction test\u003cT extends { a: string, b: string }>(obj: T): T {\r\n let { a, ...rest } = obj;\r\n return { a: 'hello', ...rest } as T; // Error, but shouldn't be\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nNo errors.\r\n\r\n**Actual behavior:**\r\n\r\nError as shown above.\r\n\r\n**Playground Link:**\r\n\r\nhttps://www.typescriptlang.org/play/index.html#src=function%20test%3CT%20extends%20%7B%20a%3A%20string%2C%20b%3A%20string%20%7D%3E(obj%3A%20T)%3A%20T%20%7B%0D%0A%20%20%20%20let%20%7B%20a%2C%20...rest%20%7D%20%3D%20obj%3B%0D%0A%20%20%20%20return%20%7B%20a%3A%20'hello'%2C%20...rest%20%7D%20as%20T%3B%0D%0A%7D%0D%0A\r\n\r\n**Related Issues:**\r\n\r\nFound while investigating #28884.","author":{"url":"https://github.com/ahejlsberg","@type":"Person","name":"ahejlsberg"},"datePublished":"2018-12-18T19:55:49Z","url":"https://github.com/microsoft/TypeScript/issues/29081"}
| 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:8f01601a-3709-3b88-d02c-90900482bfa3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E4AE:ADA9D:2C6517B:38F4D9C:6B01A8AC |
| html-safe-nonce | f3e83d57f642bdb471db23ebd58e76f41111da8145d229f791a8c784bf317fd8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEFFOkFEQTlEOjJDNjUxN0I6MzhGNEQ5Qzo2QjAxQThBQyIsInZpc2l0b3JfaWQiOiIxNzM2ODQ2NzYxNTQyMTMzOTMyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 608f07c824138bcbe3fdda0bedab5dddc7df7f8b3498067a698ab37e8ace5e9c |
| hovercard-subject-tag | issue:392311048 |
| 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/29081/issue_layout |
| twitter:image | https://opengraph.githubassets.com/84155c0724396b8e97971803049fd2e80dbbdf28f6202862dbca32c7fdcafa26/microsoft/TypeScript/issues/29081 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/84155c0724396b8e97971803049fd2e80dbbdf28f6202862dbca32c7fdcafa26/microsoft/TypeScript/issues/29081 |
| og:image:alt | TypeScript Version: 3.3.0-dev Code function test |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ahejlsberg |
| 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