(node)
| 85540 | return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); |
| 85541 | } |
| 85542 | function checkExternalModuleExports(node) { |
| 85543 | var moduleSymbol = getSymbolOfNode(node); |
| 85544 | var links = getSymbolLinks(moduleSymbol); |
| 85545 | if (!links.exportsChecked) { |
| 85546 | var exportEqualsSymbol = moduleSymbol.exports.get("export="); |
| 85547 | if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { |
| 85548 | var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; |
| 85549 | if (declaration && !isTopLevelInExternalModuleAugmentation(declaration) && !ts.isInJSFile(declaration)) { |
| 85550 | error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); |
| 85551 | } |
| 85552 | } |
| 85553 | // Checks for export * conflicts |
| 85554 | var exports_3 = getExportsOfModule(moduleSymbol); |
| 85555 | if (exports_3) { |
| 85556 | exports_3.forEach(function (_a, id) { |
| 85557 | var declarations = _a.declarations, flags = _a.flags; |
| 85558 | if (id === "__export") { |
| 85559 | return; |
| 85560 | } |
| 85561 | // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. |
| 85562 | // (TS Exceptions: namespaces, function overloads, enums, and interfaces) |
| 85563 | if (flags & (1920 /* SymbolFlags.Namespace */ | 384 /* SymbolFlags.Enum */)) { |
| 85564 | return; |
| 85565 | } |
| 85566 | var exportedDeclarationsCount = ts.countWhere(declarations, ts.and(isNotOverloadAndNotAccessor, ts.not(ts.isInterfaceDeclaration))); |
| 85567 | if (flags & 524288 /* SymbolFlags.TypeAlias */ && exportedDeclarationsCount <= 2) { |
| 85568 | // it is legal to merge type alias with other values |
| 85569 | // so count should be either 1 (just type alias) or 2 (type alias + merged value) |
| 85570 | return; |
| 85571 | } |
| 85572 | if (exportedDeclarationsCount > 1) { |
| 85573 | if (!isDuplicatedCommonJSExport(declarations)) { |
| 85574 | for (var _i = 0, _b = declarations; _i < _b.length; _i++) { |
| 85575 | var declaration = _b[_i]; |
| 85576 | if (isNotOverload(declaration)) { |
| 85577 | diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, ts.unescapeLeadingUnderscores(id))); |
| 85578 | } |
| 85579 | } |
| 85580 | } |
| 85581 | } |
| 85582 | }); |
| 85583 | } |
| 85584 | links.exportsChecked = true; |
| 85585 | } |
| 85586 | } |
| 85587 | function isDuplicatedCommonJSExport(declarations) { |
| 85588 | return declarations |
| 85589 | && declarations.length > 1 |
no test coverage detected
searching dependent graphs…