this is not about object {} === {},
found this issues don't know if this is the same
The set of types - AUnion is not an empty set. Two more types (L and R) are extending it. My understanding that these L, R are at least as wide as AUnion, and, therefore I expect that elements in L and R have no empty intersection - namely AUnion.
What part of TypeScript type system I'm missing?
given the TypeScript code
type AUnion = 'a'|'b';
type Proc = <L extends AUnion, R extends AUnion>(l:L, r:R)=>0|1;
declare const proc:Proc;
One can call the proc with two equal arguments
const arg:'a' = 'a';
proc(arg,arg); // this is fine (type-wise) 'a' does extend AUnion
As far as I understand 'a' is equal to 'a'. Their types are the one a and a extend the union type AUnion.
Let's implement the type.
const proc:Proc = (l, r)=>{
if(l===r){
return 0;
}
return 1;
}
Yet the TypeScript complains
This condition will always return 'false' since the types 'L' and 'R' have no overlap.
What is it I'm missing?