Skip to content

Commit 32fff2b

Browse files
committed
Fix @hidden on function implementations
Resolves #2634
1 parent 1f58143 commit 32fff2b

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- If a relative linked image is referenced multiple times, TypeDoc will no longer sometimes produce invalid links to the image #2627.
88
- `@link` tags will now be validated in referenced markdown documents, #2629.
99
- `@link` tags are now resolved in project documents, #2629.
10+
- `@hidden` is now properly applied when placed in a function implementation comment.
1011
- Comments on re-exports are now rendered.
1112

1213
### Thanks!

src/lib/converter/plugins/CommentPlugin.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -634,14 +634,12 @@ export class CommentPlugin extends ConverterComponent {
634634
(comment.hasModifier("@internal") && this.excludeInternal);
635635

636636
if (
637-
isHidden &&
637+
!isHidden &&
638638
reflection.kindOf(ReflectionKind.ContainsCallSignatures)
639639
) {
640640
return (reflection as DeclarationReflection)
641641
.getNonIndexSignatures()
642-
.every((sig) => {
643-
return !sig.comment || this.isHidden(sig);
644-
});
642+
.every((sig) => this.isHidden(sig));
645643
}
646644

647645
return isHidden;

src/test/converter2/issues/gh2634.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @param a - Number param.
3+
*/
4+
export function hidden(a: number): void;
5+
6+
/**
7+
* @param a - String param.
8+
*/
9+
export function hidden(a: string): void;
10+
11+
/** @hidden */
12+
export function hidden(a: string | number): void {
13+
console.log(a);
14+
}
15+
16+
/** @hidden */
17+
export function implicitlyHidden(x: string): void;
18+
/** @hidden */
19+
export function implicitlyHidden(x: number): void;
20+
export function implicitlyHidden() {}
21+
22+
/** @hidden */
23+
export const hiddenVariableFunc = () => 1;

src/test/issues.c2.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1636,4 +1636,9 @@ describe("Issue Tests", () => {
16361636

16371637
logger.expectNoOtherMessages();
16381638
});
1639+
1640+
it("#2634 handles @hidden on function implementations", () => {
1641+
const project = convert();
1642+
equal(project.children?.map((c) => c.name) || [], []);
1643+
});
16391644
});

0 commit comments

Comments
 (0)