@@ -9097,8 +9097,11 @@ namespace ts {
9097
9097
if (flags & TypeFlags.Intersection) {
9098
9098
return addTypesToIntersection(typeSet, includes, (<IntersectionType>type).types);
9099
9099
}
9100
- if (getObjectFlags(type) & ObjectFlags.Anonymous && isEmptyObjectType(type)) {
9101
- includes |= TypeFlags.EmptyObject;
9100
+ if (isEmptyAnonymousObjectType(type)) {
9101
+ if (!(includes & TypeFlags.EmptyObject)) {
9102
+ includes |= TypeFlags.EmptyObject;
9103
+ typeSet.push(type);
9104
+ }
9102
9105
}
9103
9106
else {
9104
9107
includes |= flags & ~TypeFlags.ConstructionFlags;
@@ -9229,8 +9232,8 @@ namespace ts {
9229
9232
includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) {
9230
9233
removeRedundantPrimitiveTypes(typeSet, includes);
9231
9234
}
9232
- if (includes & TypeFlags.EmptyObject && !( includes & TypeFlags.Object) ) {
9233
- typeSet.push(emptyObjectType );
9235
+ if (includes & TypeFlags.EmptyObject && includes & TypeFlags.Object) {
9236
+ orderedRemoveItemAt( typeSet, findIndex(typeSet, isEmptyAnonymousObjectType) );
9234
9237
}
9235
9238
if (typeSet.length === 0) {
9236
9239
return unknownType;
@@ -11277,6 +11280,10 @@ namespace ts {
11277
11280
false;
11278
11281
}
11279
11282
11283
+ function isEmptyAnonymousObjectType(type: Type) {
11284
+ return !!(getObjectFlags(type) & ObjectFlags.Anonymous) && isEmptyObjectType(type);
11285
+ }
11286
+
11280
11287
function isEnumTypeRelatedTo(sourceSymbol: Symbol, targetSymbol: Symbol, errorReporter?: ErrorReporter) {
11281
11288
if (sourceSymbol === targetSymbol) {
11282
11289
return true;
0 commit comments