isEmptyObjectType should check that argument is not generic mapped type

This commit is contained in:
Anders Hejlsberg 2018-12-17 14:08:01 -08:00
parent 4d74f67325
commit 93c0f0ca0f

View File

@ -11386,7 +11386,7 @@ namespace ts {
}
function isEmptyObjectType(type: Type): boolean {
return type.flags & TypeFlags.Object ? isEmptyResolvedType(resolveStructuredTypeMembers(<ObjectType>type)) :
return type.flags & TypeFlags.Object ? !isGenericMappedType(type) && isEmptyResolvedType(resolveStructuredTypeMembers(<ObjectType>type)) :
type.flags & TypeFlags.NonPrimitive ? true :
type.flags & TypeFlags.Union ? some((<UnionType>type).types, isEmptyObjectType) :
type.flags & TypeFlags.Intersection ? every((<UnionType>type).types, isEmptyObjectType) :
@ -12361,7 +12361,7 @@ namespace ts {
}
else {
// An empty object type is related to any mapped type that includes a '?' modifier.
if (isPartialMappedType(target) && !isGenericMappedType(source) && isEmptyObjectType(source)) {
if (isPartialMappedType(target) && isEmptyObjectType(source)) {
return Ternary.True;
}
if (isGenericMappedType(target)) {