Skip to content

Commit e040c7a

Browse files
committed
Order object types sharing a symbol by how they were created
A module's synthetic default wrapper and the spread of the module with it share a symbol and are not object literals, so nothing but their type ids distinguished them. Unnamed object types are now also ordered by the flags recording how they were created.
1 parent 822a08a commit e040c7a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎tsc/internal/checker/utilities.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,12 @@ func CompareTypes(t1, t2 *Type) int {
701701
}
702702
}
703703
}
704+
// Other types sharing a symbol, such as a module's synthetic default
705+
// wrapper and the spread of the module with it, differ in how they were
706+
// created.
707+
if c := int(t1.objectFlags&objectLiteralCreationFlags) - int(t2.objectFlags&objectLiteralCreationFlags); c != 0 {
708+
return c
709+
}
704710
}
705711
case t1.flags&TypeFlagsUnion != 0:
706712
// Unions are ordered by origin and then constituent type lists.

0 commit comments

Comments
 (0)