allow const-assertion on aliased enum symbol (#32110)

Fixes: #32087
This commit is contained in:
Klaus Meinhardt
2019-06-26 14:42:06 -07:00
committed by Ryan Cavanaugh
parent a50a5d309c
commit 392d775095
5 changed files with 129 additions and 1 deletions
+4 -1
View File
@@ -22510,7 +22510,10 @@ namespace ts {
case SyntaxKind.ElementAccessExpression:
const expr = (<PropertyAccessExpression | ElementAccessExpression>node).expression;
if (isIdentifier(expr)) {
const symbol = getSymbolAtLocation(expr);
let symbol = getSymbolAtLocation(expr);
if (symbol && symbol.flags & SymbolFlags.Alias) {
symbol = resolveAlias(symbol);
}
return !!(symbol && (symbol.flags & SymbolFlags.Enum) && getEnumKind(symbol) === EnumKind.Literal);
}
}