JSDoc support for array destructuring
See original GitHub issueCurrently there is no simple way to annotate destructured array parameters.
I propose a syntax similar to the current destructured objects syntax:
/**
* @param {[x: number, y: number]} randomName
* @return number
*/
function add([x, y]) {
return x + y;
}
Due to the nature of destructured arrays, this issue is closely related to #379.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:18
- Comments:17 (9 by maintainers)
Top Results From Across the Web
How to document array destructured parameter in JSDoc
Given the following code, how do I properly document that using the latest JSDoc? function ...
Read more >JSDoc @type doesn't work with array destructuring (but does ...
JSDoc @type doesn't work with array destructuring (but does with object destructuring) In the above, foo doesn't get typed to string , but...
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 >Destructuring assignment - JavaScript - MDN Web Docs
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from ...
Read more >Airbnb JavaScript Style Guide()
Types; References; Objects; Arrays; Destructuring; Strings; Functions ... not be used when targeting browsers/environments that don't support them natively.
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
These work in VS Code:
and
Thanks for the guidance.
Since calling React.useState is a common thing to do, I was hoping to make it possible to do so with less ceremony. Going through a wrapper seems like it might be able to streamline things while maintaining type checks:
It seems to work in the online playground