Skip to content

JSdoc template defaults syntax not work #46574

@xlfsummer

Description

@xlfsummer

Bug Report

🔎 Search Terms

  • default for a type parameter
  • JSdoc default type parameter

🕗 Version & Regression Information

💻 Code

This is the demo code on your website

/** @template [T=object] */
class Cache { // hover `Cache` to see: 'class Cache <T = object>'
    /** @param {T} initial */
    constructor(T) {
    }
}
let c = new Cache()

When I copy those code, and use tsc to generate a .d.ts file. In that .d.ts file, Cache dose not have a generate template.

demo repo

🙁 Actual behavior

output .d.ts:

There is no template defaults, and event no template.

/** @template [T=object] */
export class Cache {
    /** @param {T} initial */
    constructor(T: any);
}

🙂 Expected behavior

output .d.ts should be:

/** @template [T=object] */
export class Cache<T = object> {
    /** @param {T} initial */
    constructor(T: any);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions