Title: Incorrect error when assigning to omitted and extended record type · Issue #27883 · microsoft/TypeScript · GitHub
Open Graph Title: Incorrect error when assigning to omitted and extended record type · Issue #27883 · microsoft/TypeScript
X Title: Incorrect error when assigning to omitted and extended record type · Issue #27883 · microsoft/TypeScript
Description: TypeScript Version: typescript@3.2.0-dev.20181011 typescript@3.1.3 typescript@3.0.3 Search Terms: Code type Baa = { a: number, b: number }; type Omit () { const foo: { foo:...
Open Graph Description: TypeScript Version: typescript@3.2.0-dev.20181011 typescript@3.1.3 typescript@3.0.3 Search Terms: Code type Baa = { a: number, b: number }; type Omit
X Description: TypeScript Version: typescript@3.2.0-dev.20181011 typescript@3.1.3 typescript@3.0.3 Search Terms: Code type Baa = { a: number, b: number }; type Omit<T, K> = Pick<T, Exclude<keyof T, K&...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/27883
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect error when assigning to omitted and extended record type","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** \r\ntypescript@3.2.0-dev.20181011\r\ntypescript@3.1.3\r\ntypescript@3.0.3\r\n\r\n\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:**\r\n\r\n**Code**\r\n\r\n```ts\r\ntype Baa = { a: number, b: number };\r\ntype Omit\u003cT, K> = Pick\u003cT, Exclude\u003ckeyof T, K>>;\r\n\r\nfunction foo\u003cP extends Baa>() {\r\n const foo: { foo: string } & Omit\u003cP, 'b'> = null as any;\r\n const props: Baa = foo;\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nNo error.\r\n\r\n**Actual behavior:**\r\n\r\n```\r\ntest.ts:6:11 - error TS2322: Type '{ foo: string; } & Pick\u003cP, Exclude\u003ckeyof P, \"b\">>' is not assignable to type 'Baa'.\r\n Property 'a' is missing in type '{ foo: string; } & Pick\u003cP, Exclude\u003ckeyof P, \"b\">>'.\r\n\r\n6 const props: Baa = foo;\r\n ~~~~~\r\n```\r\n\r\nRemoving the `{ foo: string } &` works.\r\nRemoving the `Omit` works.\r\nRemoving the `P` and using `Baa` directly works.\r\n\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior -->\r\n\r\nhttps://agentcooper.github.io/typescript-play/?ts=2.9.1#code/C4TwDgpgBAQghnKBeKBvKcBcUB2BXAWwCMIAnAGiiIH5t9iyoBfAbgChRIoB5AgS2AAeACqUA0gD5kUAAp8AxgGsRlAKIAPeQBs8AEwiDFEEAHsAZlFFRJE9mzN4c84HxM4oZkycEyoEdcAQOLoAzrAIEgAUAJRobFAJUPJuIcAeXtjonibYqaR8OADmzFAAZDz8QjKUAORENVIo+FpaGGFwOCDsiUkpaWCkJmAh2PCIKNnsTGxAA\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\n","author":{"url":"https://github.com/WearyMonkey","@type":"Person","name":"WearyMonkey"},"datePublished":"2018-10-13T02:20:08Z","url":"https://github.com/microsoft/TypeScript/issues/27883"}
| 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:c6b77c51-5f65-75b7-e7a9-ebb37af4a1e6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D732:A71F9:2117E8D:29D411C:6B01AD19 |
| html-safe-nonce | e3b91ee37a5ba42ab49d324cebc12ea0f5df18c7d586fe9d282728c57fe55553 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzMyOkE3MUY5OjIxMTdFOEQ6MjlENDExQzo2QjAxQUQxOSIsInZpc2l0b3JfaWQiOiI0Mjk4NTQyNDQxNDU3MzY0MjQ5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 095e16cfd36f7ab11b35ab66562768c19906ca2b7a7685e1adf97c271b82b9e3 |
| hovercard-subject-tag | issue:369757677 |
| 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/27883/issue_layout |
| twitter:image | https://opengraph.githubassets.com/13b7427bae3a7fce3db7f2d02a6b72cb9b2f1498643370aa6e9d8c2eea408237/microsoft/TypeScript/issues/27883 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/13b7427bae3a7fce3db7f2d02a6b72cb9b2f1498643370aa6e9d8c2eea408237/microsoft/TypeScript/issues/27883 |
| og:image:alt | TypeScript Version: typescript@3.2.0-dev.20181011 typescript@3.1.3 typescript@3.0.3 Search Terms: Code type Baa = { a: number, b: number }; type Omit |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | WearyMonkey |
| 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