google / google/closure-compiler
Warning on type annotation for default values of destructuring parameters
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
In the following code, the second function warns:
```
input0:10: WARNING - parameter param does not appear in foo2's parameter list
function foo2({x} = {}) {
^
```
``` js
/**
* @param {!{x: number}} param
*/
function foo1({x}) {
}
/**
* @param {!{x: number}} param
*/
function foo2({x} = {}) {
}
```
https://closure-compiler-debugger.appspot.com/#input0%3D%252F**%250A%2520*%2520%2540param%2520%257B!%257Bx%253A%2520number%257D%257D%2520param%250A%2520*%252F%250Afunction%2520foo1(%257Bx%257D)%2520%257B%250A%257D%250A%250A%252F**%250A%2520*%2520%2540param%2520%257B!%257Bx%253A%2520number%257D%257D%2520param%250A%2520*%252F%250Afunction%2520foo2(%257Bx%257D%2520%253D%2520%257B%257D)%2520%257B%250A%257D%250A%26input1%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1
Contributor guide
Assessment
This issue has not been assessed yet.