Closed
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 type [a: 1, b?:2]
??
🔎 Search Terms
Identical type - Invalid Equality
tuple optional extends
🕗 Version & Regression Information
Discovered the issue today and it's referenced on the following stackoverflow
I did test it in the playground upto version 4.05 of typescript (syntax breaks in version prior)
⏯ Playground Link
💻 Code
type UnNullify<T extends readonly unknown[]> = {
[K in keyof T]: Exclude<T[K], null | undefined>
}
type Foo = UnNullify<[a: 1, b?: 2 | undefined]>
// [a: 1, b?: 2]
type Test = [a: 1, b?: 2] extends Foo ? true : false
// false ??
🙁 Actual behavior
Two types represented identical by the compiler do not extends each other
🙂 Expected behavior
Expected the two types to extends