Skip to content

Jsdoc ... should parse lower precedence than union #22487

@sandersn

Description

@sandersn
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: a.js

/** @param {...string|Array} rest */
function f(...rest) {
    rest
}

Expected behavior:
Rest is of type (string | any[])[]
Actual behavior:
Rest is of type (string[] | any[])

Only one ... is allowed, at the beginning of a parameter, so a lot of authors reasonably assume that it has very low precedence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationFixedA PR has been merged for this issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions