Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
interfaceFoo{bar:string;}// Should be correct, but linter show warningfunctionlogFirstBar([{ bar}]:Foo[]){console.log(bar);}// Should be correct, but linter show warningfunctionlogFirstBarInOtherWay([{ bar}]:[Foo]){console.log(bar);}// Should be correct, but linter show warningconst[[bar]]:string[][]=[['bar']]interfaceDeepFoo{a:{b:{c:Foo;}}}// With nested objects works fineconst{a:{b:{c:{bar:bar1}}}}:DeepFoo={a:{b:{c:{bar:'bar'}}}};
ESLint Config
module.exports={parser:"@typescript-eslint/parser","rules":{"@typescript-eslint/typedef":["warn",{"arrayDestructuring":true,"arrowParameter":true,"memberVariableDeclaration":true,"objectDestructuring":true,"parameter":true,"propertyDeclaration":true,"variableDeclaration":true,"variableDeclarationIgnoreFunction":true}]}};
tsconfig
No response
Expected Result
I expected that nested destructuring of arrays with types (like[{ bar }]: Foo[]
) wouldn't throw the error "Expected a type annotation" on lines 6, 11, and 16.
Actual Result
There were errors "Expected a type annotation" on the lines 6, 11, and 16
Additional Info
Similar issue connected with object restructuring#4725
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 5.29.0 |
@typescript-eslint/parser | 5.29.0 |
TypeScript | 4.6.3 |
ESLint | 8.18.0 |
node | 16.14.2 |