Skip to content

Cannot specify a JSDoc @overload signature using the @type tag #52368

Open
@DanielRosenwasser

Description

@DanielRosenwasser

Often, I use @type because the @param + @return syntax is so unwieldy; however, it's not usable with @overload.

// @ts-check

/**
 * @overload
 * @type {(x: number) => number}
 */
/**
 * @type {(x: number) => number}
 */
function id(x) {
    return x;
}

id(123).toFixed(2);
// ~~~ Expected 0 arguments, but got 1.

I'd expect the above not to error; but it does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureDomain: JSDocRelates to JSDoc parsing and type generationDomain: JavaScriptThe issue relates to JavaScript specificallySuggestionAn idea for TypeScriptcheckJsRelates to checking JavaScript using TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions