Title: Removing null and undefined from a Tuple breaks equality · Issue #50753 · microsoft/TypeScript · GitHub
Open Graph Title: Removing null and undefined from a Tuple breaks equality · Issue #50753 · microsoft/TypeScript
X Title: Removing null and undefined from a Tuple breaks equality · Issue #50753 · microsoft/TypeScript
Description: Bug Report When trying to remove nils from a Tuple it resolves to an Tuple that do not extends to the identical Tuple (as represented by the compiler) So in the example below the reult of a type is [a: 1, b?:2] which do not extends the t...
Open Graph Description: Bug Report When trying to remove nils from a Tuple it resolves to an Tuple that do not extends to the identical Tuple (as represented by the compiler) So in the example below the reult of a type is...
X Description: Bug Report When trying to remove nils from a Tuple it resolves to an Tuple that do not extends to the identical Tuple (as represented by the compiler) So in the example below the reult of a type is...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/50753
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Removing null and undefined from a Tuple breaks equality","articleBody":"# Bug Report\r\nWhen trying to remove nils from a Tuple it resolves to an Tuple that do not extends to the identical Tuple (as represented by the compiler)\r\n\r\nSo in the example below the reult of a type is `[a: 1, b?:2]` which do not extends the type `[a: 1, b?:2]` ??\r\n\r\n### 🔎 Search Terms\r\nIdentical type - Invalid Equality\r\ntuple optional extends\r\n\r\n### 🕗 Version & Regression Information\r\nDiscovered the issue today and it's referenced on the following [stackoverflow](https://stackoverflow.com/questions/73703051/identical-tuples-are-not-equals)\r\nI did test it in the playground upto version 4.05 of typescript (syntax breaks in version prior)\r\n\r\n### ⏯ Playground Link\r\n\r\n[playground](https://www.typescriptlang.org/play?#code/C4TwDgpgBAqgdgOQK4BsUEsBmIA8AVKCAD2AjgBMBnKAJwgENyB7OFEKJOAaziYHc4AbQC6APigBeKAG8AsACgoUQQGko6OFC4QQTTFDzCAXFACiRAMYok5CPlXCANFDioUUAD4cKETBojkogoAvgoKoJBQAGJMTJKwiG5YuIL0JgCMzgBGAPwmAEye3rZ+cAFiCgD0lUpQAHo5YfIR0HgQlMDxqRnZeVD5woQkZFTRsVA5UMA0SNAmmPQolBBVNUoNCkA)\r\n\r\n### 💻 Code\r\n```ts\r\ntype UnNullify\u003cT extends readonly unknown[]> = {\r\n [K in keyof T]: Exclude\u003cT[K], null | undefined>\r\n}\r\n\r\ntype Foo = UnNullify\u003c[a: 1, b?: 2 | undefined]>\r\n// [a: 1, b?: 2]\r\n\r\ntype Test = [a: 1, b?: 2] extends Foo ? true : false\r\n// false ??\r\n```\r\n\r\n### 🙁 Actual behavior\r\nTwo types represented identical by the compiler do not extends each other\r\n\r\n### 🙂 Expected behavior\r\nExpected the two types to extends\r\n","author":{"url":"https://github.com/zedryas","@type":"Person","name":"zedryas"},"datePublished":"2022-09-13T13:42:46Z","url":"https://github.com/microsoft/TypeScript/issues/50753"}
| 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:ba3f9bb9-025e-bbd3-1150-311e606bd9b5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA66:23CF06:26E3F0E:3188790:6B0184FD |
| html-safe-nonce | 505970b54116065a1d263cd9a3467d06be86ea7d1940e42339e63508f15056db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTY2OjIzQ0YwNjoyNkUzRjBFOjMxODg3OTA6NkIwMTg0RkQiLCJ2aXNpdG9yX2lkIjoiODM0NjUxMTE3NjE5NjI2MTExNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | aff8fc2c7d4d5d710937e61eb468db971e2cf624a35824f9d8687f7df55fd6ac |
| hovercard-subject-tag | issue:1371481461 |
| 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/50753/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d9281403d18903f025e74065add520e2b2569beaf37692cb3de9d37c4ffc4bc1/microsoft/TypeScript/issues/50753 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d9281403d18903f025e74065add520e2b2569beaf37692cb3de9d37c4ffc4bc1/microsoft/TypeScript/issues/50753 |
| og:image:alt | Bug Report When trying to remove nils from a Tuple it resolves to an Tuple that do not extends to the identical Tuple (as represented by the compiler) So in the example below the reult of a type is... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zedryas |
| 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