From be88d53ab37453585b449b6ab1918134087b03cf Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 25 Apr 2019 17:32:27 -0700 Subject: [PATCH] Only defer function type inference when contextual type is function type --- src/compiler/checker.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5a414c488f286..86d80b8438a9e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -23778,14 +23778,14 @@ namespace ts { const constructSignature = getSingleSignature(type, SignatureKind.Construct, /*allowMembers*/ true); const signature = callSignature || constructSignature; if (signature && signature.typeParameters) { - if (checkMode & CheckMode.SkipGenericFunctions && getSingleCallOrConstructSignature(type)) { - skippedGenericFunction(node, checkMode); - return anyFunctionType; - } const contextualType = getApparentTypeOfContextualType(node); if (contextualType && !isMixinConstructorType(contextualType)) { const contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? SignatureKind.Call : SignatureKind.Construct, /*allowMembers*/ false); if (contextualSignature && !contextualSignature.typeParameters) { + if (checkMode & CheckMode.SkipGenericFunctions) { + skippedGenericFunction(node, checkMode); + return anyFunctionType; + } const context = getInferenceContext(node)!; // We have an expression that is an argument of a generic function for which we are performing // type argument inference. The expression is of a function type with a single generic call