JSDoc comment for destructuring param: description text not displayed
See original GitHub issueTypeScript Version:
2.9
Search Terms:
JSDoc destructuring param
Code
/**
* @param {Object} arg
* @param {number} arg.id - This param description won't show up
*/
function foo({ id }) {}
Expected behavior:
In VSCode 1.24.0, when typing foo(
, IntelliSense should display the full param description, including its type and text.
Actual behavior: The type is displayed (“number”), but not the text (“This param description won’t show up”):
Related Issues: https://github.com/Microsoft/TypeScript/issues/19645
Additional remark When omitting the {Object} line, the param text shows up correctly:
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:14 (2 by maintainers)
Top Results From Across the Web
JSDoc comments for destructuring parameters not working in ...
Param type is parsed correctly, allowing for type checking. Param description text doesn't show up in IntelliSense (issue reported here).
Read more >Use JSDoc: @param
If a parameter is destructured without an explicit name, you can give the object an appropriate one and document its properties. Documenting a...
Read more >Google JavaScript Style Guide
We do not use the phrase documentation comments , instead using the common term “JSDoc” for both human-readable text and machine-readable annotations within ......
Read more >Refactoring JavaScript | WebStorm Documentation - JetBrains
Select the Search in comments and strings and Search for text ... default value in the JSDoc comment in the format @param <parameter...
Read more >eslint-plugin-jsdoc - npm
settings.jsdoc.ignorePrivate - Disables all rules for the comment block on which a @private tag (or @access private ) occurs. Defaults to false ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@THoisington, for that to work, you need to first define a custom object for the options, and then define its properties. Then you assign that custom type as your parameter:
That’ll give you IntelliSense for each property on the options parameter.
I’m having the same issue, I’m currently using javascript, and the solution provided by @lookuh partially implemented works in an awkward way.
When used the JSDocs comments in this way, it for sure won’t show the destructured params comments:
But when at least one of the param is defined as property, it starts to show the other params comments correctly, but it does not give type to them:
And a full typedef with @property solution isn’t showing the destructured params:
Hope this comment helps in any way.