Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters does not copy function description message. #46353

Closed
jespertheend opened this issue Oct 13, 2021 · 2 comments
Closed

Parameters does not copy function description message. #46353

jespertheend opened this issue Oct 13, 2021 · 2 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@jespertheend
Copy link
Contributor

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

@andrewbranch andrewbranch added the Working as Intended The behavior described is the intended behavior; this is not a bug label Oct 14, 2021
@andrewbranch
Copy link
Member

I think it would be super unexpected if this happened. The parameters of some function do not fully represent the function declaration.

@jespertheend
Copy link
Contributor Author

Is there any other way to transfer a function description like this that I'm not aware of? I'd really like to be able to autocomplete/document overloaded functions with pure js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants