Allow const assertions in constant expressions

This commit is contained in:
Anders Hejlsberg 2024-07-30 09:28:37 -07:00
parent d7ff565b6c
commit e0036e65e8

View File

@ -11110,6 +11110,11 @@ export function createEvaluator({ evaluateElementAccessExpression, evaluateEntit
break;
case SyntaxKind.ElementAccessExpression:
return evaluateElementAccessExpression(expr as ElementAccessExpression, location);
case SyntaxKind.AsExpression:
if (isConstTypeReference((expr as AsExpression).type)) {
return evaluate((expr as AsExpression).expression, location);
}
break;
}
return evaluatorResult(/*value*/ undefined, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences);
}