Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the comment for the first signature if a later signature does not have a comment #2718

Closed
Gerrit0 opened this issue Sep 28, 2024 · 0 comments
Labels
enhancement Improved functionality
Milestone

Comments

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Sep 28, 2024

Search Terms

[warning] functions/someFile.foo (CallSignature), defined in ./src/functions/someFile.ts, does not have any documentation

Problem

Given the following code, TypeDoc complains that the second signature is missing a comment.

/** Helper function to do something. */
export function foo(fatal: true): string;
export function foo(fatal: false): string | undefined;
export function foo(fatal: boolean): string | undefined {
  return "";
}

TypeScript copies the comment from the first signature to other signatures when a function is overloaded and they do not specify a separate comment.

Suggested Solution

TypeDoc should copy the comment from the first signature to other signatures when a function is overloaded and they do not specify a separate comment.

This should also work for method declarations, Array.reduce in the standard library has a similar structure.

Reported on discord by @Zamiell

@Gerrit0 Gerrit0 added the enhancement Improved functionality label Sep 28, 2024
Gerrit0 added a commit that referenced this issue Sep 28, 2024
@Gerrit0 Gerrit0 added this to the v0.27.0 milestone Sep 28, 2024
@Gerrit0 Gerrit0 closed this as completed Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
None yet
Development

No branches or pull requests

1 participant