Skip to content

Parameters does not copy function description message.Β #46353

Closed
@jespertheend

Description

@jespertheend

Bug Report

πŸ”Ž Search Terms

parameters jsdoc description message

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about parameters

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

/**
 * A function that returns the number you pass to it.
 */
function myCoolFunction(x : number) {}

function basicallyTheSameFunction(...args : Parameters<typeof myCoolFunction>) {}

Then hover over basicallyTheSameFunction.

πŸ™ Actual behavior

The function does not have a description, whereas myCoolFunction does.

πŸ™‚ Expected behavior

The basicallyTheSameFunction would have the same description as myCoolFunction.

πŸ“ƒ Motivating Example

I'm not familiar with the inner workings of TypeScript, so in case this is more of a feature request rather than a bug report, please consider the following use case: playground link
When working with jsdoc only, I think the cleanest way of supporting overloaded functions for Intellisense is like this:

/**
 * This function takes a number and a string.
 * @param {number} num
 * @param {string} str
 */
function signatureA(num, str) {}

/**
 * This function takes a boolean and an object
 * @param {boolean} bool
 * @param {Object} obj
 */
function signatureB(bool, obj) {}

/**
 * @param {Parameters<typeof signatureA> | Parameters<typeof signatureB>} args
 */
function overloaded(...args) {}

Then when typing overloaded(), the parameter suggestions window will show all the possible signatures, but unfortunately descriptions are not copied this way.
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions