File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -13255,12 +13255,12 @@ namespace ts {
13255
13255
return includes;
13256
13256
}
13257
13257
13258
- function removeSubtypes(types: Type[]): boolean {
13258
+ function removeSubtypes(types: Type[], hasObjectTypes: boolean ): boolean {
13259
13259
// We assume that redundant primitive types have already been removed from the types array and that there
13260
13260
// are no any and unknown types in the array. Thus, the only possible supertypes for primitive types are empty
13261
13261
// object types, and if none of those are present we can exclude primitive types from the subtype check.
13262
- const hasEmptyObject = some(types, t => !!(t.flags & TypeFlags.Object) && !isGenericMappedType(t) && isEmptyResolvedType(resolveStructuredTypeMembers(<ObjectType>t)));
13263
- let len = types.length;
13262
+ const hasEmptyObject = hasObjectTypes && some(types, t => !!(t.flags & TypeFlags.Object) && !isGenericMappedType(t) && isEmptyResolvedType(resolveStructuredTypeMembers(<ObjectType>t)));
13263
+ const len = types.length;
13264
13264
let i = len;
13265
13265
let count = 0;
13266
13266
while (i > 0) {
@@ -13382,7 +13382,7 @@ namespace ts {
13382
13382
}
13383
13383
}
13384
13384
if (unionReduction & UnionReduction.Subtype) {
13385
- if (!removeSubtypes(typeSet)) {
13385
+ if (!removeSubtypes(typeSet, !!(includes & TypeFlags.Object) )) {
13386
13386
return errorType;
13387
13387
}
13388
13388
}
You can’t perform that action at this time.
0 commit comments