mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-31 18:10:56 -05:00
Collect contravariant-only inference candidates from shorter annotated functions (#52609)
This commit is contained in:
committed by
GitHub
parent
377fe1f34f
commit
a6ba2e735d
@@ -35646,6 +35646,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
assignNonContextualParameterTypes(signature);
|
||||
}
|
||||
}
|
||||
else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
|
||||
const inferenceContext = getInferenceContext(node);
|
||||
if (checkMode && checkMode & CheckMode.Inferential) {
|
||||
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext!);
|
||||
}
|
||||
}
|
||||
if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
|
||||
const returnType = getReturnTypeFromBody(node, checkMode);
|
||||
if (!signature.resolvedReturnType) {
|
||||
|
||||
Reference in New Issue
Block a user