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

Function jsdocTreatAsExported

test/fixtures/snapshot/typescript.js:45066–45087  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

45064 }
45065 }
45066 function jsdocTreatAsExported(node) {
45067 if (node.parent && ts.isModuleDeclaration(node)) {
45068 node = node.parent;
45069 }
45070 if (!ts.isJSDocTypeAlias(node))
45071 return false;
45072 // jsdoc typedef handling is a bit of a doozy, but to summarize, treat the typedef as exported if:
45073 // 1. It has an explicit name (since by default typedefs are always directly exported, either at the top level or in a container), or
45074 if (!ts.isJSDocEnumTag(node) && !!node.fullName)
45075 return true;
45076 // 2. The thing a nameless typedef pulls its name from is implicitly a direct export (either by assignment or actual export flag).
45077 var declName = ts.getNameOfDeclaration(node);
45078 if (!declName)
45079 return false;
45080 if (ts.isPropertyAccessEntityNameExpression(declName.parent) && isTopLevelNamespaceAssignment(declName.parent))
45081 return true;
45082 if (ts.isDeclaration(declName.parent) && ts.getCombinedModifierFlags(declName.parent) & 1 /* ModifierFlags.Export */)
45083 return true;
45084 // This could potentially be simplified by having `delayedBindJSDocTypedefTag` pass in an override for `hasExportModifier`, since it should
45085 // already have calculated and branched on most of this.
45086 return false;
45087 }
45088 // All container nodes are kept on a linked list in declaration order. This list is used by
45089 // the getLocalNameOfContainer function in the type checker to validate that the local name
45090 // used for a container is unique.

Callers 1

declareModuleMemberFunction · 0.85

Calls 1

Tested by

no test coverage detected