@@ -1023,8 +1023,8 @@ namespace ts {
10231023 }
10241024 }
10251025
1026- function getDeclarationOfAliasSymbol(symbol: Symbol): Declaration {
1027- return findMap (symbol.declarations, d => isAliasSymbolDeclaration(d) ? d : undefined);
1026+ function getDeclarationOfAliasSymbol(symbol: Symbol): Declaration | undefined {
1027+ return forEach (symbol.declarations, d => isAliasSymbolDeclaration(d) ? d : undefined);
10281028 }
10291029
10301030 function getTargetOfImportEqualsDeclaration(node: ImportEqualsDeclaration): Symbol {
@@ -1191,6 +1191,7 @@ namespace ts {
11911191 if (!links.target) {
11921192 links.target = resolvingSymbol;
11931193 const node = getDeclarationOfAliasSymbol(symbol);
1194+ Debug.assert(!!node);
11941195 const target = getTargetOfAliasDeclaration(node);
11951196 if (links.target === resolvingSymbol) {
11961197 links.target = target || unknownSymbol;
@@ -1226,6 +1227,7 @@ namespace ts {
12261227 if (!links.referenced) {
12271228 links.referenced = true;
12281229 const node = getDeclarationOfAliasSymbol(symbol);
1230+ Debug.assert(!!node);
12291231 if (node.kind === SyntaxKind.ExportAssignment) {
12301232 // export default <symbol>
12311233 checkExpressionCached((<ExportAssignment>node).expression);
@@ -18761,7 +18763,13 @@ namespace ts {
1876118763 (augmentations || (augmentations = [])).push(file.moduleAugmentations);
1876218764 }
1876318765 if (file.symbol && file.symbol.globalExports) {
18764- mergeSymbolTable(globals, file.symbol.globalExports);
18766+ // Merge in UMD exports with first-in-wins semantics (see #9771)
18767+ const source = file.symbol.globalExports;
18768+ for (const id in source) {
18769+ if (!(id in globals)) {
18770+ globals[id] = source[id];
18771+ }
18772+ }
1876518773 }
1876618774 });
1876718775
0 commit comments