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

"Delegate" type aliases render summary in wrong location #2372

Closed
jonchardy opened this issue Aug 24, 2023 · 3 comments
Closed

"Delegate" type aliases render summary in wrong location #2372

jonchardy opened this issue Aug 24, 2023 · 3 comments
Labels
bug Functionality does not match expectation

Comments

@jonchardy
Copy link
Contributor

jonchardy commented Aug 24, 2023

Search terms

Type Alias
Delegate
Handler

Expected Behavior

The following type declaration should render with its comment just below the signature.

/**
 * The signature for a function acting as an event handler.
 */
export type EventHandler = ((e: Event) => void);

It should appear like this (without the | null, added to show expected output).

image

Actual Behavior

Typedoc renders the description as part of the type declaration.

image

Steps to reproduce the bug

Repro here:
TypeStrong/typedoc-repros#30

Environment

  • Typedoc version: 0.24.8
  • TypeScript version: 5.1.6
  • Node.js version: 18.13.0
  • OS: Windows 11
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 25, 2023

This happens because @param tags in that comment should be attached to the function's parameters, so the entire comment is implicitly considered to belong to the function, which is a really unfortunate way of making that work...

@LennardF1989
Copy link

LennardF1989 commented Aug 25, 2023

This happens because @param tags in that comment should be attached to the function's parameters, so the entire comment is implicitly considered to belong to the function, which is a really unfortunate way of making that work...

So is this fixable? Is there a workaround, even if draconic?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 25, 2023

/**
 * The signature for a function acting as an event handler.
 */
export type EventHandler = ((e: Event) => void) & {};

is the same type, but is not detected as a function signature, so kinda sorta works...

This should be fixable, unfortunately signature comment handling is really convoluted, likely not a trivial change.

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

3 participants