Skip to content

Type parameters of generic javascript classes are stripped of their types #2929

Closed
@stwlam

Description

@stwlam

Search terms

template, typeParam, class

Expected Behavior

Types of javascript class type parameters, if present, are rendered.

Actual Behavior

Types of javascript class type parameters, when present, are not rendered.

Steps to reproduce the bug

Add the following to the example/classes directory (also export from index and turn on allowJs:

/**
 * @template {number} T
 */
export class NumberManager {
     /**
      *
      * @param {T[]} nums
      */
    constructor(nums) {
        this.nums = nums;
    }

    /** @type {T[]} */
    nums;
}

Build the examples and note the lack of the number type for T in the class type parameter but not the constructor's:

Environment

  • Typedoc version: 0.28.1
  • TypeScript version: 5.6.3
  • Node.js version: 22.14.0
  • OS: Ubuntu 22.04.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    jsThis issue relates to better TS-in-JS support

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions