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

Function reportNonDefaultExport

test/fixtures/snapshot/typescript.js:50522–50541  ·  view source on GitHub ↗
(moduleSymbol, node)

Source from the content-addressed store, hash-verified

50520 }
50521 }
50522 function reportNonDefaultExport(moduleSymbol, node) {
50523 var _a, _b, _c;
50524 if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has(node.symbol.escapedName)) {
50525 error(node.name, ts.Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead, symbolToString(moduleSymbol), symbolToString(node.symbol));
50526 }
50527 else {
50528 var diagnostic = error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
50529 var exportStar = (_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.get("__export" /* InternalSymbolName.ExportStar */);
50530 if (exportStar) {
50531 var defaultExport = (_c = exportStar.declarations) === null || _c === void 0 ? void 0 : _c.find(function (decl) {
50532 var _a, _b;
50533 return !!(ts.isExportDeclaration(decl) && decl.moduleSpecifier &&
50534 ((_b = (_a = resolveExternalModuleName(decl, decl.moduleSpecifier)) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.has("default" /* InternalSymbolName.Default */)));
50535 });
50536 if (defaultExport) {
50537 ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(defaultExport, ts.Diagnostics.export_Asterisk_does_not_re_export_a_default));
50538 }
50539 }
50540 }
50541 }
50542 function getTargetOfNamespaceImport(node, dontResolveAlias) {
50543 var moduleSpecifier = node.parent.parent.moduleSpecifier;
50544 var immediate = resolveExternalModuleName(node, moduleSpecifier);

Callers 1

getTargetOfImportClauseFunction · 0.85

Calls 6

symbolToStringFunction · 0.85
errorFunction · 0.70
hasMethod · 0.65
getMethod · 0.65
findMethod · 0.65

Tested by

no test coverage detected