Title: Pick
Open Graph Title: Pick
X Title: Pick
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 }>(obj: T) { let { a, ...rest } = obj; return { ...rest, b: a }; } let o1 = { a: 'hello', x: 42 }; let o2: { b: ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/29067
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pick\u003cT, xxx> sometimes considered an empty type","articleBody":"**TypeScript Version:** 3.3.0-dev\r\n\r\n**Code**\r\n\r\n```ts\r\nfunction test\u003cT extends { a: string }>(obj: T) {\r\n let { a, ...rest } = obj;\r\n return { ...rest, b: a };\r\n}\r\n\r\nlet o1 = { a: 'hello', x: 42 };\r\nlet o2: { b: string, x: number } = test(o1); // Error, but shouldn't be\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nNo error.\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%20%7D%3E(obj%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%20...rest%2C%20b%3A%20a%20%7D%3B%0D%0A%7D%0D%0A%0D%0Alet%20o1%20%3D%20%7B%20a%3A%20'hello'%2C%20x%3A%2042%20%7D%3B%0D%0Alet%20o2%3A%20%7B%20b%3A%20string%2C%20x%3A%20number%20%7D%20%3D%20test(o1)%3B%0D%0A\r\n\r\n**Related Issues:**\r\n\r\nFound while investigating #29062.","author":{"url":"https://github.com/ahejlsberg","@type":"Person","name":"ahejlsberg"},"datePublished":"2018-12-17T22:01:15Z","url":"https://github.com/microsoft/TypeScript/issues/29067"}
| 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:73ada1b6-7f17-919e-91c7-1cecbd1003a9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9B5A:240CD1:2AE8C88:3691583:6B01ADA7 |
| html-safe-nonce | 29222a4e6e938ba532dc8ec42ade6433f2116540e2fe6e412a43b651b6ad222c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjVBOjI0MENEMToyQUU4Qzg4OjM2OTE1ODM6NkIwMUFEQTciLCJ2aXNpdG9yX2lkIjoiMzM5NTAxNDg5OTEzNDQxNzAzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4084b64639571318f30a2bb55955177764203ea33736cba709650a97a263ebd7 |
| hovercard-subject-tag | issue:391907887 |
| 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/29067/issue_layout |
| twitter:image | https://opengraph.githubassets.com/93582685b7eef0a1850ac5d14049a9c228c4473049c72e35ebe48e8c0bff1751/microsoft/TypeScript/issues/29067 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/93582685b7eef0a1850ac5d14049a9c228c4473049c72e35ebe48e8c0bff1751/microsoft/TypeScript/issues/29067 |
| 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