Skip to content

Commit

Permalink
Do not attach module comments to non-modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Jun 4, 2022
1 parent 7918fba commit f57c812
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 78 deletions.
10 changes: 10 additions & 0 deletions src/lib/converter/comments/index.ts
Expand Up @@ -77,6 +77,16 @@ export function getComment(
}
}

if (!symbol.declarations?.some(ts.isSourceFile) && comment) {
// Ensure module comments are not attached to non-module reflections.
if (
comment.hasModifier("@packageDocumentation") ||
comment.getTag("@module")
) {
return;
}
}

return comment;
}

Expand Down
23 changes: 0 additions & 23 deletions src/test/converter/exports/specs.json
Expand Up @@ -888,29 +888,6 @@
"flags": {
"isConst": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "This module has documentation, but no exported members do."
}
],
"blockTags": [
{
"tag": "@see",
"content": [
{
"kind": "text",
"text": "https://github.com/TypeStrong/typedoc/issues/1948"
}
]
},
{
"tag": "@module",
"content": []
}
]
},
"sources": [
{
"fileName": "no-doc-members.ts",
Expand Down
55 changes: 0 additions & 55 deletions src/test/converter/exports/specs.nodoc.json
Expand Up @@ -255,61 +255,6 @@
}
]
},
"children": [
{
"id": 39,
"name": "abc",
"kind": 32,
"kindString": "Variable",
"flags": {
"isConst": true
},
"comment": {
"summary": [
{
"kind": "text",
"text": "This module has documentation, but no exported members do."
}
],
"blockTags": [
{
"tag": "@see",
"content": [
{
"kind": "text",
"text": "https://github.com/TypeStrong/typedoc/issues/1948"
}
]
},
{
"tag": "@module",
"content": []
}
]
},
"sources": [
{
"fileName": "no-doc-members.ts",
"line": 6,
"character": 13,
"url": "https://github.com/TypeStrong/typedoc/blob/fake/src/test/converter/exports/no-doc-members.ts#L6"
}
],
"type": {
"type": "literal",
"value": 123
},
"defaultValue": "123"
}
],
"groups": [
{
"title": "Variables",
"children": [
39
]
}
],
"sources": [
{
"fileName": "no-doc-members.ts",
Expand Down

0 comments on commit f57c812

Please sign in to comment.