google / google/closure-compiler

Improve JSDoc support for destructured parameters

Open
#1,781 7 comments 7 reactions 0 assignees View on GitHub
enhancement ES6
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Currently it is very cumbersome to use destructuring for function parameters with more than a couple properties, particular if many are optional:

``` js
@param {{a: (number|undefined), b: (number|undefined), c: (number|undefined)}} param1
```

Note that the `number=` syntax does not work, and in fact leads to #1762.

Ideally we could write

``` js
/**
@param {number=} a
@param {number=} b
@param {number=} c
*/
function({a = 1, b = 2, c = 3} = {}) {}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.