Skip to content

Commit

Permalink
fix: filter out junk
Browse files Browse the repository at this point in the history
Co-authored-by: Willow (GHOST) <ghostdevv@users.noreply.github.com>
  • Loading branch information
braebo and ghostdevv committed Dec 22, 2023
1 parent d4fd44e commit 07d27c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-mugs-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'extractinator': patch
---

fix: filter out junk
14 changes: 12 additions & 2 deletions src/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,18 @@ export function createTSDocParser(tsdocConfigPath?: string) {
}

export function parseCommentFromNode(node: Node, parser: TSDocParser) {
const tsdoc_node = node.getFirstChildByKind(ts.SyntaxKind.JSDoc)
return tsdoc_node ? parseComment(tsdoc_node.getText(), parser) : undefined
const tsdoc_node = node
.getChildrenOfKind(ts.SyntaxKind.JSDoc)
?.map((node) => node.getText())
// Filter out typedefs (they aren't particularly useful)
.filter((text) => {
// todo better solution
return !text.startsWith('/** @typedef {typeof __propDef.')
})

//? There should only be one comment per node (I think)
const comment = tsdoc_node?.[0]
return comment ? parseComment(comment, parser) : undefined
}

/**
Expand Down

0 comments on commit 07d27c8

Please sign in to comment.