Skip to content

@overload Tags do not receive noImplicitAny errors on missing return types #52514

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Playground Link

// @ts-check

/**
 * @overload
 * @param {number} x
 */

/**
 * @overload
 * @param {string} x
 */

/**
 * @param {string | number} x
 * @returns {string | number}
 */
function id(x) {
    return x;
}

export let a = id(123);
export let b = id("hello");

Here, the first two signatures of id are missing an @return/@returns tag. That means that they're implicitly any.

Under noImplicitAny, this example should issue an error on both @overload tags saying that they implicitly return the type any.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationEffort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".Fix AvailableA PR has been opened for this issueHelp WantedYou can do thischeckJsRelates to checking JavaScript using TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions