Skip to content

Commit

Permalink
Fix @hidden on function implementations
Browse files Browse the repository at this point in the history
Resolves #2634
  • Loading branch information
Gerrit0 committed Jul 10, 2024
1 parent 1f58143 commit 32fff2b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- If a relative linked image is referenced multiple times, TypeDoc will no longer sometimes produce invalid links to the image #2627.
- `@link` tags will now be validated in referenced markdown documents, #2629.
- `@link` tags are now resolved in project documents, #2629.
- `@hidden` is now properly applied when placed in a function implementation comment.
- Comments on re-exports are now rendered.

### Thanks!
Expand Down
6 changes: 2 additions & 4 deletions src/lib/converter/plugins/CommentPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,14 +634,12 @@ export class CommentPlugin extends ConverterComponent {
(comment.hasModifier("@internal") && this.excludeInternal);

if (
isHidden &&
!isHidden &&
reflection.kindOf(ReflectionKind.ContainsCallSignatures)
) {
return (reflection as DeclarationReflection)
.getNonIndexSignatures()
.every((sig) => {
return !sig.comment || this.isHidden(sig);
});
.every((sig) => this.isHidden(sig));
}

return isHidden;
Expand Down
23 changes: 23 additions & 0 deletions src/test/converter2/issues/gh2634.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @param a - Number param.
*/
export function hidden(a: number): void;

/**
* @param a - String param.
*/
export function hidden(a: string): void;

/** @hidden */
export function hidden(a: string | number): void {
console.log(a);
}

/** @hidden */
export function implicitlyHidden(x: string): void;
/** @hidden */
export function implicitlyHidden(x: number): void;
export function implicitlyHidden() {}

/** @hidden */
export const hiddenVariableFunc = () => 1;
5 changes: 5 additions & 0 deletions src/test/issues.c2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1636,4 +1636,9 @@ describe("Issue Tests", () => {

logger.expectNoOtherMessages();
});

it("#2634 handles @hidden on function implementations", () => {
const project = convert();
equal(project.children?.map((c) => c.name) || [], []);
});
});

0 comments on commit 32fff2b

Please sign in to comment.