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

Function returned by a class method copies the method's docs #2336

Closed
mweidner037 opened this issue Jul 13, 2023 · 0 comments
Closed

Function returned by a class method copies the method's docs #2336

mweidner037 opened this issue Jul 13, 2023 · 0 comments
Labels
bug Functionality does not match expectation

Comments

@mweidner037
Copy link

Search terms

Anonymous function, function return, currying, inherit

Expected Behavior

When a class method returns an anonymous function, the anonymous function should either have no documentation (besides the method's @return annotation) or its own documentation.

Actual Behavior

When a class method returns an anonymous function, the anonymous function copies the method's docs.

Example code:

export class ClassVersion {
  /**
   * This is the outer function.
   *
   * @returns The inner function.
   */
  outer(): () => void {
    /** Docs for the inner function? */
    return () => {};
  }
}

Generated docs:
image

Steps to reproduce the bug

https://github.com/mweidner037/mwe-typedoc-returned-function

Environment

  • Typedoc version: 0.24.8
  • TypeScript version: 5.1.6
  • Node.js version: 16.13.1
  • OS: Ubuntu 22.04

More info

If the outer function is a standalone function instead of a class method, it behaves as I would expect:

/**
 * This is the outer function.
 *
 * @returns The inner function.
 */
export function outerAsFunction(): () => void {
  /** Docs for the inner function? */
  return () => {};
}

Generated docs:

image

Potentially related issue: #2283 (comment)

@mweidner037 mweidner037 added the bug Functionality does not match expectation label Jul 13, 2023
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

1 participant