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

@typeParam is broken for type aliases #1733

Closed
nex3 opened this issue Oct 7, 2021 · 1 comment
Closed

@typeParam is broken for type aliases #1733

nex3 opened this issue Oct 7, 2021 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@nex3
Copy link

nex3 commented Oct 7, 2021

Expected Behavior

I would expect to be able to document a type parameter on a type alias like so:

/**
 * @typeParam A Some documentation.
 */
export type Foo<A> = A;

Actual Behavior

The documentation shows up in a tagged section rather than under the type parameter:

image

Steps to reproduce the bug

Just run npx typedoc test.ts on the above code.

Environment

  • Typedoc version: 0.22.4
  • TypeScript version: 4.3.5
  • Node.js version: 16.10.0
  • OS: Linux
@nex3 nex3 added the bug Functionality does not match expectation label Oct 7, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Oct 10, 2021

Aww shoot, I broke this nearly 2 years ago now, you're the first to notice. The root cause of this is TypeDoc not treating comments as a first-class citizen where they are created when a reflection is created... instead doing it on a "created" event. This works most of the time, but not in this case, because the reflection was finalized (which is when comments are attached) after type parameters were created, but the @typeParam handling expects the comment to be there when the type parameter is created.

The right solution to this is to do comments on reflection construction (actually, before, but even that would be an improvement. I plan to do this with 0.23), but for now a fix is just to swap the order of finalization and type parameter construction.

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