getExternalModuleMember:always resolve alias of moduleSymbol (#43718)

Previously, getExternalModuleMember passed through its received value of
`dontResolveAlias` to every function that accepted it. That includes (1)
resolution of the module symbol and (2) resolution of the module
specifier. However, in TS, the module symbol is never an alias anyway, so
dontResolveAlias doesn't make a difference. In JS, the module symbol
*can* be an alias, and it should always be resolved. That's what this PR
does.

Fixes #43713
This commit is contained in:
Nathan Shively-Sanders
2021-04-30 10:47:45 -07:00
committed by GitHub
parent d16790e3cc
commit c9eb62fafb
6 changed files with 6382 additions and 1 deletions

View File

@@ -2742,7 +2742,7 @@ namespace ts {
return undefined;
}
const suppressInteropError = name.escapedText === InternalSymbolName.Default && !!(compilerOptions.allowSyntheticDefaultImports || compilerOptions.esModuleInterop);
const targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, dontResolveAlias, suppressInteropError);
const targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, /*dontResolveAlias*/ false, suppressInteropError);
if (targetSymbol) {
if (name.escapedText) {
if (isShorthandAmbientModuleSymbol(moduleSymbol)) {