File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13255,12 +13255,12 @@ namespace ts {
1325513255 return includes;
1325613256 }
1325713257
13258- function removeSubtypes(types: Type[]): boolean {
13258+ function removeSubtypes(types: Type[], hasObjectTypes: boolean ): boolean {
1325913259 // We assume that redundant primitive types have already been removed from the types array and that there
1326013260 // are no any and unknown types in the array. Thus, the only possible supertypes for primitive types are empty
1326113261 // 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;
1326413264 let i = len;
1326513265 let count = 0;
1326613266 while (i > 0) {
@@ -13382,7 +13382,7 @@ namespace ts {
1338213382 }
1338313383 }
1338413384 if (unionReduction & UnionReduction.Subtype) {
13385- if (!removeSubtypes(typeSet)) {
13385+ if (!removeSubtypes(typeSet, !!(includes & TypeFlags.Object) )) {
1338613386 return errorType;
1338713387 }
1338813388 }
You can’t perform that action at this time.
0 commit comments