Title: `Omit` from #31115 makes all properties required · Issue #31190 · microsoft/TypeScript · GitHub
Open Graph Title: `Omit` from #31115 makes all properties required · Issue #31190 · microsoft/TypeScript
X Title: `Omit` from #31115 makes all properties required · Issue #31190 · microsoft/TypeScript
Description: Since the changes of #31115, Omit
Open Graph Description: Since the changes of #31115, Omit
X Description: Since the changes of #31115, Omit<T, K> makes all properties of T required. TypeScript Version: 3.5.0-dev.20190501, 3.4.5 Search Terms: omit optional Code type A = { a: number; b?: string; };...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/31190
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Omit` from #31115 makes all properties required","articleBody":"Since the changes of #31115, `Omit\u003cT, K>` makes all properties of `T` required.\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:** 3.5.0-dev.20190501, 3.4.5\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** omit optional\r\n\r\n**Code**\r\n\r\n```ts\r\ntype A = {\r\n a: number;\r\n b?: string;\r\n};\r\n\r\ntype B = Omit\u003cA, 'a'>;\r\n```\r\n\r\n**Expected behavior:** `B` is `{ b?: string }` (`{ b?: string | undefined }` with `strictNullChecks`).\r\n\r\n**Actual behavior:** `B` is `{ b: string }` (`{ b: string | undefined }` with `strictNullChecks`), with property `b` required.\r\n\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior --> [link](https://www.typescriptlang.org/play/index.html#src=type%20Omit1%3CT%2C%20K%20extends%20keyof%20any%3E%20%3D%20Pick%3CT%2C%20Exclude%3Ckeyof%20T%2C%20K%3E%3E%3B%0D%0Atype%20Omit2%3CT%2C%20K%20extends%20keyof%20any%3E%20%3D%20%7B%0D%0A%20%20%20%20%5BP%20in%20Exclude%3Ckeyof%20T%2C%20K%3E%5D%3A%20T%5BP%5D%0D%0A%7D%3B%0D%0A%0D%0Atype%20A%20%3D%20%7B%0D%0A%20%20%20%20a%3A%20number%3B%0D%0A%20%20%20%20b%3F%3A%20string%3B%0D%0A%7D%3B%0D%0A%0D%0Atype%20B1%20%3D%20Omit1%3CA%2C%20'a'%3E%3B%0D%0A%2F%2F%20B1%20%3D%20%7B%20b%3F%3A%20string%3B%20%7D%0D%0A%0D%0Atype%20B2%20%3D%20Omit2%3CA%2C%20'a'%3E%3B%0D%0A%2F%2F%20B2%20%3D%20%7B%20b%3A%20string%3B%20%7D%0D%0A)\r\n\r\npin @DanielRosenwasser","author":{"url":"https://github.com/InExtremaRes","@type":"Person","name":"InExtremaRes"},"datePublished":"2019-05-01T17:07:30Z","url":"https://github.com/microsoft/TypeScript/issues/31190"}
| 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:6125d631-bbc8-c1c0-b9e8-35d9aa6dee42 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA2C:A99C2:2FC07C6:3CBBBCA:6B01B0F9 |
| html-safe-nonce | a54b47255ef60f3cdd69043e63dd83ddaef67f21596797776e6047de8afb153a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTJDOkE5OUMyOjJGQzA3QzY6M0NCQkJDQTo2QjAxQjBGOSIsInZpc2l0b3JfaWQiOiI3MTIzMzQ1MTczODY0MDYzNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 160d327be00e8446d8a2531a322466453e91d8b7cb90a76b295a3a708447e44f |
| hovercard-subject-tag | issue:439240118 |
| 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/31190/issue_layout |
| twitter:image | https://opengraph.githubassets.com/857578c20eb9e4a807f3065146819bed32ae214fb00b79a9987a5b604942a755/microsoft/TypeScript/issues/31190 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/857578c20eb9e4a807f3065146819bed32ae214fb00b79a9987a5b604942a755/microsoft/TypeScript/issues/31190 |
| og:image:alt | Since the changes of #31115, Omit |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | InExtremaRes |
| 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