mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 02:35:48 -05:00
Add missed resolveSymbol in commonjs import resolution (#41479)
Fixes resolution of export aliases in the postfix-property-access case
of commonjs require:
```js
const { x } = require('./foo').nested
x
```
This program would previously fail if `x` was an export alias.
Fixes #41422
This commit is contained in:
committed by
GitHub
parent
728c9cc1bf
commit
9fb6acf1e1
@@ -2790,7 +2790,7 @@ namespace ts {
|
||||
const resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
|
||||
const name = node.propertyName || node.name;
|
||||
if (commonJSPropertyAccess && resolved && isIdentifier(name)) {
|
||||
return getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText);
|
||||
return resolveSymbol(getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText), dontResolveAlias);
|
||||
}
|
||||
markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false);
|
||||
return resolved;
|
||||
|
||||
Reference in New Issue
Block a user