MCPcopy Create free account
hub / github.com/Effect-TS/effect / parseDocumentedTs

Function parseDocumentedTs

packages/tools/jsdocs/src/Jsdocs.ts:2708–2739  ·  view source on GitHub ↗
(
  node: ts.Node,
  scope: DocScope,
  diagnostics: Array<JSDocModelDiagnostic>,
  required = true,
  linkContext?: { readonly checker: ts.TypeChecker; readonly entry: ProgramCacheEntry; readonly cwd: string }
)

Source from the content-addressed store, hash-verified

2706}
2707
2708function parseDocumentedTs(
2709 node: ts.Node,
2710 scope: DocScope,
2711 diagnostics: Array<JSDocModelDiagnostic>,
2712 required = true,
2713 linkContext?: { readonly checker: ts.TypeChecker; readonly entry: ProgramCacheEntry; readonly cwd: string }
2714) {
2715 const block = getNodeJSDoc(node)
2716 if (block?.internal) return undefined
2717 if (block === undefined) {
2718 if (required) {
2719 diagnostics.push({
2720 ...diagnostic("missing-jsdoc", scope === "member" ? "Member JSDoc is required" : "Public JSDoc is required"),
2721 range: nodeRange(node)
2722 })
2723 }
2724 return undefined
2725 }
2726 addModelDiagnostics(diagnostics, block.range, block.diagnostics)
2727 if (block.parsed === undefined) return undefined
2728 const tags = buildTags(scope, block.parsed.tags)
2729 if (tags._tag === "Failure") {
2730 addModelDiagnostics(diagnostics, block.range, tags.error.diagnostics)
2731 return undefined
2732 }
2733 const parsedTags = tags.value as ParsedDeclarationTags | ParsedNamespaceTags | ParsedMemberTags
2734 if (linkContext !== undefined) addJSDocLinkDiagnostics(node.getSourceFile(), block, diagnostics, linkContext)
2735 return {
2736 core: block.parsed,
2737 tags: linkContext === undefined ? parsedTags : attachSeeLinkSymbols(parsedTags, node, block, linkContext)
2738 }
2739}
2740
2741function hasExportModifier(node: ts.Node): boolean {
2742 return ts.canHaveModifiers(node) &&

Callers 3

parseTsMembersFunction · 0.85
parseNamespaceTsFunction · 0.85
parseSourceFileDocsFunction · 0.85

Calls 8

getNodeJSDocFunction · 0.85
diagnosticFunction · 0.85
nodeRangeFunction · 0.85
addModelDiagnosticsFunction · 0.85
buildTagsFunction · 0.85
addJSDocLinkDiagnosticsFunction · 0.85
attachSeeLinkSymbolsFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected