(node, specifier, dontResolveAlias)
| 50606 | } |
| 50607 | } |
| 50608 | function getExternalModuleMember(node, specifier, dontResolveAlias) { |
| 50609 | var _a, _b; |
| 50610 | if (dontResolveAlias === void 0) { dontResolveAlias = false; } |
| 50611 | var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier; |
| 50612 | var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); // TODO: GH#18217 |
| 50613 | var name = !ts.isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name; |
| 50614 | if (!ts.isIdentifier(name)) { |
| 50615 | return undefined; |
| 50616 | } |
| 50617 | var suppressInteropError = name.escapedText === "default" /* InternalSymbolName.Default */ && !!(compilerOptions.allowSyntheticDefaultImports || ts.getESModuleInterop(compilerOptions)); |
| 50618 | var targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, /*dontResolveAlias*/ false, suppressInteropError); |
| 50619 | if (targetSymbol) { |
| 50620 | if (name.escapedText) { |
| 50621 | if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { |
| 50622 | return moduleSymbol; |
| 50623 | } |
| 50624 | var symbolFromVariable = void 0; |
| 50625 | // First check if module was specified with "export=". If so, get the member from the resolved type |
| 50626 | if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)) { |
| 50627 | symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.escapedText, /*skipObjectFunctionPropertyAugment*/ true); |
| 50628 | } |
| 50629 | else { |
| 50630 | symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText); |
| 50631 | } |
| 50632 | // if symbolFromVariable is export - get its final target |
| 50633 | symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); |
| 50634 | var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias); |
| 50635 | if (symbolFromModule === undefined && name.escapedText === "default" /* InternalSymbolName.Default */) { |
| 50636 | var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile); |
| 50637 | if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) { |
| 50638 | symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); |
| 50639 | } |
| 50640 | } |
| 50641 | var symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ? |
| 50642 | combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : |
| 50643 | symbolFromModule || symbolFromVariable; |
| 50644 | if (!symbol) { |
| 50645 | var moduleName = getFullyQualifiedName(moduleSymbol, node); |
| 50646 | var declarationName = ts.declarationNameToString(name); |
| 50647 | var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol); |
| 50648 | if (suggestion !== undefined) { |
| 50649 | var suggestionName = symbolToString(suggestion); |
| 50650 | var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName); |
| 50651 | if (suggestion.valueDeclaration) { |
| 50652 | ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName)); |
| 50653 | } |
| 50654 | } |
| 50655 | else { |
| 50656 | if ((_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.has("default" /* InternalSymbolName.Default */)) { |
| 50657 | error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName); |
| 50658 | } |
| 50659 | else { |
| 50660 | reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName); |
| 50661 | } |
| 50662 | } |
| 50663 | } |
| 50664 | return symbol; |
| 50665 | } |
no test coverage detected
searching dependent graphs…