fix(49419): Referencing this through a variable causes "Rename Symbol" to misbehave in Javascript (#56540)

This commit is contained in:
Oleksandr T
2023-12-12 01:12:55 +02:00
committed by GitHub
parent ca9cb7c5c2
commit 369eeb1bde
10 changed files with 42 additions and 12 deletions

View File

@@ -46946,9 +46946,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
case AssignmentDeclarationKind.ExportsProperty:
case AssignmentDeclarationKind.PrototypeProperty:
return getSymbolOfNode(entityName.parent);
case AssignmentDeclarationKind.Property:
if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
return undefined;
}
// falls through
case AssignmentDeclarationKind.ThisProperty:
case AssignmentDeclarationKind.ModuleExports:
case AssignmentDeclarationKind.Property:
return getSymbolOfDeclaration(entityName.parent.parent as BinaryExpression);
}
}