Skip to content

Commit 11d1ab7

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 d505602 commit 11d1ab7

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
@@ -706,6 +706,12 @@ func CompareTypes(t1, t2 *Type) int {
706706
}
707707
}
708708
}
709+
// Other types sharing a symbol, such as a module's synthetic default
710+
// wrapper and the spread of the module with it, differ in how they were
711+
// created.
712+
if c := int(t1.objectFlags&objectLiteralCreationFlags) - int(t2.objectFlags&objectLiteralCreationFlags); c != 0 {
713+
return c
714+
}
709715
}
710716
case t1.flags&TypeFlagsUnion != 0:
711717
// Unions are ordered by origin and then constituent type lists.

0 commit comments

Comments
 (0)