fix #15447: object is empty object type (#16290)

This commit is contained in:
Herrington Darkholme
2017-06-07 01:08:33 +08:00
committed by Mohamed Hegazy
parent a6e1cedfd7
commit 0600a27dd9
4 changed files with 33 additions and 2 deletions

View File

@@ -8599,6 +8599,7 @@ namespace ts {
function isEmptyObjectType(type: Type): boolean {
return type.flags & TypeFlags.Object ? isEmptyResolvedType(resolveStructuredTypeMembers(<ObjectType>type)) :
type.flags & TypeFlags.NonPrimitive ? true :
type.flags & TypeFlags.Union ? forEach((<UnionType>type).types, isEmptyObjectType) :
type.flags & TypeFlags.Intersection ? !forEach((<UnionType>type).types, t => !isEmptyObjectType(t)) :
false;