File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -34523,6 +34523,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
34523
34523
}
34524
34524
return getRegularTypeOfLiteralType(exprType);
34525
34525
}
34526
+ const links = getNodeLinks(node);
34527
+ links.assertionExpressionType = exprType;
34526
34528
checkSourceElement(type);
34527
34529
checkNodeDeferred(node);
34528
34530
return getTypeFromTypeNode(type);
@@ -34547,9 +34549,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
34547
34549
}
34548
34550
34549
34551
function checkAssertionDeferred(node: JSDocTypeAssertion | AssertionExpression) {
34550
- const { type, expression } = getAssertionTypeAndExpression(node);
34552
+ const { type } = getAssertionTypeAndExpression(node);
34551
34553
const errNode = isParenthesizedExpression(node) ? type : node;
34552
- const exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(checkExpression(expression)));
34554
+ const links = getNodeLinks(node);
34555
+ Debug.assertIsDefined(links.assertionExpressionType);
34556
+ const exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(links.assertionExpressionType));
34553
34557
const targetType = getTypeFromTypeNode(type);
34554
34558
if (!isErrorType(targetType)) {
34555
34559
addLazyDiagnostic(() => {
Original file line number Diff line number Diff line change @@ -6060,6 +6060,7 @@ export interface NodeLinks {
6060
6060
spreadIndices ?: { first : number | undefined , last : number | undefined } ; // Indices of first and last spread elements in array literal
6061
6061
parameterInitializerContainsUndefined ?: boolean ; // True if this is a parameter declaration whose type annotation contains "undefined".
6062
6062
fakeScopeForSignatureDeclaration ?: boolean ; // True if this is a fake scope injected into an enclosing declaration chain.
6063
+ assertionExpressionType ?: Type ; // Cached type of the expression of a type assertion
6063
6064
}
6064
6065
6065
6066
/** @internal */
You can’t perform that action at this time.
0 commit comments