Skip to content

no-undefined-types does not consider @template definitions with type constraints #428

@Elberet

Description

@Elberet

When running in typescript mode (settings.jsdoc.mode = "typescript"), template types with type constraints are ignored by the no-undefined-types rule:

/**
 * Run callback when hooked method is called.
 *
 * @template {BaseObject} T
 * @param {T} obj - object whose method should be hooked.
 * @param {string} method - method which should be hooked.
 * @param {(sender: T) => void} callback - callback which should
 * be called when the hooked method was invoked.
 */
function registerEvent(obj, method, callback) { ... }

In the example above, the type constraint on T results in jsdoc/no-undefined-types emitting a warning "The type 'T' is undefined". See the Typescript handbook for more examples on typed templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions