mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 02:21:30 -05:00
Only defer function type inference when contextual type is function type
This commit is contained in:
@@ -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(<Expression>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
|
||||
|
||||
Reference in New Issue
Block a user