Skip to content

Commit be88d53

Browse files
committed
Only defer function type inference when contextual type is function type
1 parent 50f5e16 commit be88d53

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23778,14 +23778,14 @@ namespace ts {
2377823778
const constructSignature = getSingleSignature(type, SignatureKind.Construct, /*allowMembers*/ true);
2377923779
const signature = callSignature || constructSignature;
2378023780
if (signature && signature.typeParameters) {
23781-
if (checkMode & CheckMode.SkipGenericFunctions && getSingleCallOrConstructSignature(type)) {
23782-
skippedGenericFunction(node, checkMode);
23783-
return anyFunctionType;
23784-
}
2378523781
const contextualType = getApparentTypeOfContextualType(<Expression>node);
2378623782
if (contextualType && !isMixinConstructorType(contextualType)) {
2378723783
const contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? SignatureKind.Call : SignatureKind.Construct, /*allowMembers*/ false);
2378823784
if (contextualSignature && !contextualSignature.typeParameters) {
23785+
if (checkMode & CheckMode.SkipGenericFunctions) {
23786+
skippedGenericFunction(node, checkMode);
23787+
return anyFunctionType;
23788+
}
2378923789
const context = getInferenceContext(node)!;
2379023790
// We have an expression that is an argument of a generic function for which we are performing
2379123791
// type argument inference. The expression is of a function type with a single generic call

0 commit comments

Comments
 (0)