Skip to content

Commit a05ebc4

Browse files
committed
Preserve order in union types
1 parent acd8c77 commit a05ebc4

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4076,10 +4076,6 @@ namespace ts {
40764076
}
40774077
}
40784078

4079-
function compareTypeIds(type1: Type, type2: Type): number {
4080-
return type1.id - type2.id;
4081-
}
4082-
40834079
// We always deduplicate the constituent type set based on object identity, but we'll also deduplicate
40844080
// based on the structure of the types unless the noDeduplication flag is true, which is the case when
40854081
// creating a union type from a type node and when instantiating a union type. In both of those cases,
@@ -4101,7 +4097,6 @@ namespace ts {
41014097
else {
41024098
removeDuplicateTypes(typeSet);
41034099
}
4104-
typeSet.sort(compareTypeIds);
41054100
if (typeSet.length === 1) {
41064101
return typeSet[0];
41074102
}

0 commit comments

Comments
 (0)