From a7b463544642e5387afde0619d656f03a719c662 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 5 Oct 2018 14:40:23 -0700 Subject: [PATCH] Add object check to justify cast (#27576) --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0ca3136e5f9..7d15aa64b8c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10619,7 +10619,7 @@ namespace ts { target.flags & TypeFlags.Union ? some((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)); }