google / google/closure-compiler
Declaration JSDoc doesn't work with destructuring.
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
``` javascript
const values = ['a', 1];
const /** string */ s = values[0];
const /** number */ n = values[1];
const [ /** string */ x, /** number */ y] = values;
```
```
JSC_MISPLACED_ANNOTATION: Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses? at line 5 character 22
const [ /** string */ x, /** number */ y] = values;
^
JSC_MISPLACED_ANNOTATION: Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses? at line 5 character 39
const [ /** string */ x, /** number */ y] = values;
^
```
https://closure-compiler.appspot.com/home#code%3D%252F%252F%2520%253D%253DClosureCompiler%253D%253D%250A%252F%252F%2520%2540compilation_level%2520SIMPLE_OPTIMIZATIONS%250A%252F%252F%2520%2540output_file_name%2520default.js%250A%252F%252F%2520%253D%253D%252FClosureCompiler%253D%253D%250A%250Aconst%2520values%2520%253D%2520%255B'a'%252C%25201%255D%253B%250Aconst%2520%252F**%2520string%2520*%252F%2520s%2520%253D%2520values%255B0%255D%253B%250Aconst%2520%252F**%2520number%2520*%252F%2520n%2520%253D%2520values%255B1%255D%253B%250A%250Aconst%2520%255B%2520%252F**%2520string%2520*%252F%2520x%252C%2520%252F**%2520number%2520*%252F%2520y%255D%2520%253D%2520values%253B%250A
Behaviour is the same with the `/** @type {} */` form.
Contributor guide
Assessment
This issue has not been assessed yet.