fix(55494): Invalid declaration with computed property using imported symbol (#55529)

This commit is contained in:
Oleksandr T
2023-08-28 21:40:03 +03:00
committed by GitHub
parent 788239ff87
commit 9d0dc77712
5 changed files with 90 additions and 0 deletions

View File

@@ -100,6 +100,7 @@ import {
isBindingPattern,
isClassDeclaration,
isClassElement,
isComputedPropertyName,
isDeclaration,
isElementAccessExpression,
isEntityName,
@@ -701,6 +702,9 @@ export function transformDeclarations(context: TransformationContext) {
if (elem.kind === SyntaxKind.OmittedExpression) {
return elem;
}
if (elem.propertyName && isComputedPropertyName(elem.propertyName) && isEntityNameExpression(elem.propertyName.expression)) {
checkEntityNameVisibility(elem.propertyName.expression, enclosingDeclaration);
}
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
// Unnecessary property renaming is forbidden in types, so remove renaming
return factory.updateBindingElement(