diff --git a/CHANGELOG.md b/CHANGELOG.md index 667933a59..59567db0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Types rendered in the `Returns` header are now properly colored, #2546. - Links added with the `navigationLinks` option are now moved into the pull out navigation on mobile displays, #2548. - `@license` and `@import` comments will be ignored at the top of files, #2552. +- Fixed issue in documentation validation where constructor signatures where improperly considered not documented, #2553. ### Thanks! diff --git a/src/lib/validation/documentation.ts b/src/lib/validation/documentation.ts index 29e7fcdda..213bc88b3 100644 --- a/src/lib/validation/documentation.ts +++ b/src/lib/validation/documentation.ts @@ -71,6 +71,15 @@ export function validateDocumentation( continue; } + // Call signatures are considered documented if they are directly within a documented type alias. + if ( + ref.kindOf(ReflectionKind.ConstructorSignature) && + ref.parent?.parent?.kindOf(ReflectionKind.TypeAlias) + ) { + toProcess.push(ref.parent.parent); + continue; + } + if (ref instanceof DeclarationReflection) { const signatures = ref.type instanceof ReflectionType diff --git a/src/test/converter2/issues/gh2553.ts b/src/test/converter2/issues/gh2553.ts new file mode 100644 index 000000000..892454b11 --- /dev/null +++ b/src/test/converter2/issues/gh2553.ts @@ -0,0 +1,16 @@ +/** + * Constructor. + * + * @param args - Constructor arguments. + * @returns New instance. + */ +export type Constructor = new (...args: any[]) => object; + +/** + * Typed constructor. + * + * @typeParam T - Class type. + * @param args - Constructor arguments. + * @returns New instance. + */ +export type TypedConstructor = new (...args: any[]) => T; diff --git a/src/test/issues.c2.test.ts b/src/test/issues.c2.test.ts index 033067d1e..c41b253d6 100644 --- a/src/test/issues.c2.test.ts +++ b/src/test/issues.c2.test.ts @@ -1438,4 +1438,10 @@ describe("Issue Tests", () => { "This is an awesome module.", ); }); + + it("Does not warn about documented constructor signature type aliases, #2553", () => { + const project = convert(); + app.validate(project); + logger.expectNoOtherMessages(); + }); });