mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 11:24:49 -05:00
Revert 7181c2af
This commit is contained in:
@@ -14393,12 +14393,6 @@ namespace ts {
|
||||
return isEmptyObjectType(type) || !!(type.flags & (TypeFlags.Null | TypeFlags.Undefined | TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive | TypeFlags.Index));
|
||||
}
|
||||
|
||||
function isSinglePropertyAnonymousObjectType(type: Type) {
|
||||
return !!(type.flags & TypeFlags.Object) &&
|
||||
!!(getObjectFlags(type) & ObjectFlags.Anonymous) &&
|
||||
(length(getPropertiesOfType(type)) === 1 || every(getPropertiesOfType(type), p => !!(p.flags & SymbolFlags.Optional)));
|
||||
}
|
||||
|
||||
function tryMergeUnionOfObjectTypeAndEmptyObject(type: UnionType, readonly: boolean): Type | undefined {
|
||||
if (type.types.length === 2) {
|
||||
const firstType = type.types[0];
|
||||
@@ -14406,10 +14400,10 @@ namespace ts {
|
||||
if (every(type.types, isEmptyObjectTypeOrSpreadsIntoEmptyObject)) {
|
||||
return isEmptyObjectType(firstType) ? firstType : isEmptyObjectType(secondType) ? secondType : emptyObjectType;
|
||||
}
|
||||
if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(firstType) && isSinglePropertyAnonymousObjectType(secondType)) {
|
||||
if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(firstType)) {
|
||||
return getAnonymousPartialType(secondType);
|
||||
}
|
||||
if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(secondType) && isSinglePropertyAnonymousObjectType(firstType)) {
|
||||
if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(secondType)) {
|
||||
return getAnonymousPartialType(firstType);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user