Skip to content

valid-types cannot parse @throws {@link SomeType} #1380

@LukeAbby

Description

@LukeAbby

Expected behavior

I expected no error.

Actual behavior

I get an error saying it's invalid. I considered posting this issue on https://github.com/jsdoc-type-pratt-parser based upon the guidance in this issue format but I don't believe it's part of the concern of that library. My hypothesis is that it expects the type to be of the form @throws SomeType or @throws {SomeType} not @throws {@link SomeType} and so is giving the wrong part of the tag to the parser.

I'm using jsdoc.configs["flat/recommended-typescript"] but I do apologize if this is some TypeScript-specific setting I should have toggled. For evidence that this is valid TypeScript syntax look at https://tsdoc.org/pages/tags/throws/

ESLint Config

{
    "jsdoc/valid-types": "error"
}

ESLint sample

/**
 * @throws {@link Error}
 */
declare function someFunction(): void;

Environment

  • Node version: v20.15.0
  • ESLint version v9.26.0
  • eslint-plugin-jsdoc version: ^50.6.11

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions