Add object check to justify cast (#27576)

This commit is contained in:
Wesley Wigham
2018-10-05 14:40:23 -07:00
committed by GitHub
parent 4ad6541646
commit a7b4635446

View File

@@ -10619,7 +10619,7 @@ namespace ts {
target.flags & TypeFlags.Union ? some((<UnionType>target).types, t => isTypeDerivedFrom(source, t)) :
source.flags & TypeFlags.InstantiableNonPrimitive ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) :
target === globalObjectType ? !!(source.flags & (TypeFlags.Object | TypeFlags.NonPrimitive)) :
target === globalFunctionType ? isFunctionObjectType(source as ObjectType) :
target === globalFunctionType ? !!(source.flags & TypeFlags.Object) && isFunctionObjectType(source as ObjectType) :
hasBaseType(source, getTargetType(target));
}