MCPcopy Create free account
hub / github.com/nodejs/node / reportNonExportedMember

Function reportNonExportedMember

test/fixtures/snapshot/typescript.js:50668–50692  ·  view source on GitHub ↗
(node, name, declarationName, moduleSymbol, moduleName)

Source from the content-addressed store, hash-verified

50666 }
50667 }
50668 function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
50669 var _a, _b;
50670 var localSymbol = (_b = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals) === null || _b === void 0 ? void 0 : _b.get(name.escapedText);
50671 var exports = moduleSymbol.exports;
50672 if (localSymbol) {
50673 var exportedEqualsSymbol = exports === null || exports === void 0 ? void 0 : exports.get("export=" /* InternalSymbolName.ExportEquals */);
50674 if (exportedEqualsSymbol) {
50675 getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) :
50676 error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
50677 }
50678 else {
50679 var exportedSymbol = exports ? ts.find(symbolsToArray(exports), function (symbol) { return !!getSymbolIfSameReference(symbol, localSymbol); }) : undefined;
50680 var diagnostic = exportedSymbol ? error(name, ts.Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) :
50681 error(name, ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName);
50682 if (localSymbol.declarations) {
50683 ts.addRelatedInfo.apply(void 0, __spreadArray([diagnostic], ts.map(localSymbol.declarations, function (decl, index) {
50684 return ts.createDiagnosticForNode(decl, index === 0 ? ts.Diagnostics._0_is_declared_here : ts.Diagnostics.and_here, declarationName);
50685 }), false));
50686 }
50687 }
50688 }
50689 else {
50690 error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName);
50691 }
50692 }
50693 function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
50694 if (moduleKind >= ts.ModuleKind.ES2015) {
50695 var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_a_default_import :

Callers 1

getExternalModuleMemberFunction · 0.85

Calls 9

getSymbolIfSameReferenceFunction · 0.85
symbolsToArrayFunction · 0.85
symbolToStringFunction · 0.85
errorFunction · 0.70
getMethod · 0.65
findMethod · 0.65
mapMethod · 0.65
applyMethod · 0.45

Tested by

no test coverage detected