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

Undocumented void return value produces warning #2644

Closed
jpikl opened this issue Jul 18, 2024 · 1 comment
Closed

Undocumented void return value produces warning #2644

jpikl opened this issue Jul 18, 2024 · 1 comment
Labels
bug Functionality does not match expectation
Milestone

Comments

@jpikl
Copy link

jpikl commented Jul 18, 2024

Search terms

notDocumented, void, return warning

Expected Behavior

Typedoc should not produce warning for undocumented void return value of arrow functions.

Actual Behavior

Typedocs warns about void return value not being documented.

Steps to reproduce the bug

index.ts

/**
 * This one is OK.
 *
 * @param value - Value.
 */
export function voidFunction(value: unknown): void {
    // ...
}

/**
 * This one produces the following warning:
 * 
 * > [warning] voidLambda (CallSignature), defined in ./index.ts, does not have any documentation
 *
 * @param value - Value.
 */
export const voidLambda = (value: unknown): void => {
    // ...
};

/**
 * This one does not produce warning.
 *
 * @param value - Value.
 * @returns Workaround (return docs which should not be necessary here).
 */
export const voidLambdaFixed = (value: unknown): void => {
    // ...
};

tsconfig.json

{
    "compilerOptions": {
      "target": "ESNext",
      "module": "ESNext",
      "esModuleInterop": true,
      "forceConsistentCasingInFileNames": true,
      "strict": true,
      "skipLibCheck": true
    }
  }

typedoc.json

{
    "entryPoints": ["index.ts"],
    "validation": {
        "notDocumented": true
    }
}

Environment

  • Typedoc version: 0.26.4
  • TypeScript version: 5.5.3
  • Node.js version: 20.13.0
  • OS: Linux
@jpikl jpikl added the bug Functionality does not match expectation label Jul 18, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jul 21, 2024

This happens because TypeDoc's model for const-functions is slightly different than regular functions. For const-functions, TypeDoc attaches the comment to the ReflectionKind.Function reflection, while for regular functions, TypeDoc attaches it to ReflectionKind.Signature.

The @returns block works around this because it gets copied down to the signature.

What TypeDoc should be doing is not marking the signature as non-documented in this case because the owning reflection contains a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants