Actually instantiate the type of the annotation used for contextual types (#45285)

This commit is contained in:
Wesley Wigham
2021-08-02 12:44:56 -07:00
committed by GitHub
parent afe9cf5307
commit 7669bfba15
5 changed files with 113 additions and 1 deletions

View File

@@ -25413,7 +25413,7 @@ namespace ts {
// We avoid calling back into `getTypeOfExpression` and reentering contextual typing to avoid a bogus circularity error in that case.
if (decl && (isPropertyDeclaration(decl) || isPropertySignature(decl))) {
const overallAnnotation = getEffectiveTypeAnnotationNode(decl);
return (overallAnnotation && getTypeFromTypeNode(overallAnnotation)) ||
return (overallAnnotation && instantiateType(getTypeFromTypeNode(overallAnnotation), getSymbolLinks(lhsSymbol).mapper)) ||
(decl.initializer && getTypeOfExpression(binaryExpression.left));
}
if (kind === AssignmentDeclarationKind.None) {