File tree 1 file changed +2
-8
lines changed
1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -14393,23 +14393,17 @@ namespace ts {
14393
14393
return isEmptyObjectType(type) || !!(type.flags & (TypeFlags.Null | TypeFlags.Undefined | TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive | TypeFlags.Index));
14394
14394
}
14395
14395
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
-
14402
14396
function tryMergeUnionOfObjectTypeAndEmptyObject(type: UnionType, readonly: boolean): Type | undefined {
14403
14397
if (type.types.length === 2) {
14404
14398
const firstType = type.types[0];
14405
14399
const secondType = type.types[1];
14406
14400
if (every(type.types, isEmptyObjectTypeOrSpreadsIntoEmptyObject)) {
14407
14401
return isEmptyObjectType(firstType) ? firstType : isEmptyObjectType(secondType) ? secondType : emptyObjectType;
14408
14402
}
14409
- if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(firstType) && isSinglePropertyAnonymousObjectType(secondType) ) {
14403
+ if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(firstType)) {
14410
14404
return getAnonymousPartialType(secondType);
14411
14405
}
14412
- if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(secondType) && isSinglePropertyAnonymousObjectType(firstType) ) {
14406
+ if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(secondType)) {
14413
14407
return getAnonymousPartialType(firstType);
14414
14408
}
14415
14409
}
You can’t perform that action at this time.
0 commit comments