Why is
type a = {} extends {a?:number}? true:false;
evaluated as true,
while type b = {a?:number} extends {}? true:false;
is also true!It seems like the empty object
{}
acts as a supertype that can extend other types. This raises some questions about how compatibility between types is judged. Typically, I've used Set theory to explain type relationships, but it doesn't seem to fully address this situation with optional properties and the empty object extension.Could TypeScript be doing something special with the concept of
{}
in these cases?