Skip to content

Commit 17d996e

Browse files
committed
Revert 7181c2a
1 parent b508914 commit 17d996e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/compiler/checker.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -14393,23 +14393,17 @@ namespace ts {
1439314393
return isEmptyObjectType(type) || !!(type.flags & (TypeFlags.Null | TypeFlags.Undefined | TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive | TypeFlags.Index));
1439414394
}
1439514395

14396-
function isSinglePropertyAnonymousObjectType(type: Type) {
14397-
return !!(type.flags & TypeFlags.Object) &&
14398-
!!(getObjectFlags(type) & ObjectFlags.Anonymous) &&
14399-
(length(getPropertiesOfType(type)) === 1 || every(getPropertiesOfType(type), p => !!(p.flags & SymbolFlags.Optional)));
14400-
}
14401-
1440214396
function tryMergeUnionOfObjectTypeAndEmptyObject(type: UnionType, readonly: boolean): Type | undefined {
1440314397
if (type.types.length === 2) {
1440414398
const firstType = type.types[0];
1440514399
const secondType = type.types[1];
1440614400
if (every(type.types, isEmptyObjectTypeOrSpreadsIntoEmptyObject)) {
1440714401
return isEmptyObjectType(firstType) ? firstType : isEmptyObjectType(secondType) ? secondType : emptyObjectType;
1440814402
}
14409-
if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(firstType) && isSinglePropertyAnonymousObjectType(secondType)) {
14403+
if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(firstType)) {
1441014404
return getAnonymousPartialType(secondType);
1441114405
}
14412-
if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(secondType) && isSinglePropertyAnonymousObjectType(firstType)) {
14406+
if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(secondType)) {
1441314407
return getAnonymousPartialType(firstType);
1441414408
}
1441514409
}

0 commit comments

Comments
 (0)