mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Don't crash when renaming a JS property declared via module.exports (#40297)
Fixes #38070 When the originating definition was of the form ```js module.exports.foo = expr ``` we were incorrectly trying to call `resolveName` on just the `foo` portion to get the "local" symbol, which simply failed to resolve (or would have resolved to the wrong thing), but for this form, the local symbol is just the containing property access expression
This commit is contained in:
1 parent
3c576f108c
commit
79d3058b83
4 files changed
+185
-27
No files matched your search
@@ -644,7 +644,8 @@ namespace ts.FindAllReferences {
|
||||
return checker.getExportSpecifierLocalTargetSymbol(declaration)!;
|
||||
}
|
||||
else if (isPropertyAccessExpression(declaration) && isModuleExportsAccessExpression(declaration.expression) && !isPrivateIdentifier(declaration.name)) {
|
||||
return checker.getExportSpecifierLocalTargetSymbol(declaration.name)!;
|
||||
// Export of form 'module.exports.propName = expr';
|
||||
return checker.getSymbolAtLocation(declaration)!;
|
||||
}
|
||||
else if (isShorthandPropertyAssignment(declaration)
|
||||
&& isBinaryExpression(declaration.parent.parent)
|
||||
|
||||
Reference in new issue
Block a user