Do not consider UMD alias symbols as visible within external modules (#18049)

* Do not consider UMD alias symbols as visible within external modules in the symbol writer

* Minimal repro
This commit is contained in:
Wesley Wigham
2017-09-06 22:07:30 -07:00
committed by GitHub
parent 72884b8f27
commit c3e090695e
16 changed files with 103 additions and 13 deletions

View File

@@ -2095,6 +2095,10 @@ namespace ts {
canQualifySymbol(symbolFromSymbolTable, meaning);
}
function isUMDExportSymbol(symbol: Symbol) {
return symbol && symbol.declarations && symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
}
function trySymbolTable(symbols: SymbolTable) {
// If symbol is directly available by its name in the symbol table
if (isAccessible(symbols.get(symbol.escapedName))) {
@@ -2106,6 +2110,7 @@ namespace ts {
if (symbolFromSymbolTable.flags & SymbolFlags.Alias
&& symbolFromSymbolTable.escapedName !== "export="
&& !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)
&& !(isUMDExportSymbol(symbolFromSymbolTable) && isExternalModule(getSourceFileOfNode(enclosingDeclaration)))
// If `!useOnlyExternalAliasing`, we can use any type of alias to get the name
&& (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration))) {