Skip to content

jsdoc/no-undefined-types incorrect behavior together with the TS is operator #1591

@what1s1ove

Description

@what1s1ove

First of all, thank you for your work on this plugin. I currently have the following issue. Currently, the jsdoc/no-undefined-types rule behaves strangely with the TypeScript is operator.

Expected behavior

/**
 * @template {unknown} T
 * @param {unknown} value
 * @param {...T} validValues
 * @returns {value is T}
 */
const checkIsOnOf = (value, ...validValues) => {
	return validValues.includes(value);
};

With no jsdoc/no-undefined-types error.

Actual behavior

The code above will fail with the error: "5:1 error The type 'value' is undefined jsdoc/no-undefined-types". Please note that the syntax is fully valid TypeScript, and TypeScript handles it just fine.

Environment

  • Node version: 24.11.0
  • ESLint version: 9.39.0
  • eslint-plugin-jsdoc version: 61.1.11
    PS. I upgraded from eslint-plugin-jsdoc version 46.9.0, and this issue did not exist in that version. Although I know that, in general, no-undefined-types is a problematic rule 🫠

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions