Skip to content

JS Doc comment not shown in signature help when overload tag existsΒ #55939

Closed
@ITenthusiasm

Description

@ITenthusiasm

πŸ”Ž Search Terms

overload jsdoc

πŸ•— Version & Regression Information

Because @overload was introduced in TS 5.0, I don't think this is a regression. It may just be something that was missed when overloads were introduced.

⏯ Playground Link

πŸ’» Code

/* -------------------- Distinct Docs -------------------- */
/**
 * Do something with number
 * @overload
 * @param {number} a
 * @returns {void}
 */

/**
 * Stringing
 * @overload
 * @param {string} a
 * @returns {void}
 */

/**
 * @param {string | number} a
 * @returns {void}
 */
function doSomething(a) {}

doSomething(1);
doSomething("");
Also See
/* -------------------- Fallthrough -------------------- */
/**
 * This does something different
 * @overload
 * @param {boolean} b
 * @returns {void}
 */

/**
 * @overload
 * @param {object} b
 * @returns {void}
 */

/**
 * @param {boolean | object} b
 * @returns {void}
 */
function doSomethingDifferent(b) {}

doSomethingDifferent(true);
doSomethingDifferent({});

/* -------------------- Deferred Fallthrough -------------------- */
/**
 * @overload
 * @param {Event} c
 * @returns {void}
 */

/**
 * Only Mutation Observers do cool things
 * @overload
 * @param {MutationObserver} c
 * @returns {void}
 */

/**
 * @param {MutationObserver | Event} c
 * @returns {void}
 */
function anotherThing(c) {}

anotherThing(new Event("click"));
anotherThing(new MutationObserver(() => {}));

πŸ™ Actual behavior

The types resulting from the JSDocs are correct, but the comments are lost. This same issue occurs for overloaded constructors.

πŸ™‚ Expected behavior

As is the case for regular overloads in TypeScript (example), I would expect my JSDoc comments that use the @overload tag to be preserved.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions