Skip to content

Commit 14b87cf

Browse files
committed
Allow comments on signature parents to count for docs
This is necessary because TypeDoc 0.26 allows function reflections to have documentation comments, not just signature reflections. This edge case was missed when adding support for that. Resolves #2644
1 parent 44a72e5 commit 14b87cf

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/lib/validation/documentation.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ export function validateDocumentation(
100100

101101
const symbolId = project.getSymbolIdFromReflection(ref);
102102

103-
if (!ref.hasComment() && symbolId) {
103+
// #2644, signatures may be documented by their parent reflection.
104+
const hasComment =
105+
ref.hasComment() ||
106+
(ref.kindOf(ReflectionKind.SomeSignature) &&
107+
ref.parent?.hasComment());
108+
109+
if (!hasComment && symbolId) {
104110
if (symbolId.fileName.includes("node_modules")) {
105111
continue;
106112
}

src/test/converter2/issues/gh2644.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Lambda docs
3+
* @param value - Value.
4+
*/
5+
export const voidLambda = (value: unknown): void => {
6+
// ...
7+
};

src/test/issues.c2.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1663,4 +1663,11 @@ describe("Issue Tests", () => {
16631663
[[]],
16641664
);
16651665
});
1666+
1667+
it("#2644 allows comments on signature parents to count for being documented", () => {
1668+
app.options.setValue("validation", { notDocumented: true });
1669+
const project = convert();
1670+
app.validate(project);
1671+
logger.expectNoOtherMessages();
1672+
});
16661673
});

0 commit comments

Comments
 (0)