-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'typedef/arrayDestructuring': impossible to follow this rule in for/of
statement
#1564
Comments
The problem here is that the rule selects on Similar problem for the |
@bradzacher Thank you for the explanation about cause of this rule. |
happy to accept a PR if you need it fixed urgently. It's a simple enough fix. |
I am very sorry to decline you invitation to |
Additional cases for (const [[key]] of [[['key']]]) {}
for (const [[{ key }]] of [[[{ key: 'value' }]]]) {}
for (const {p1: {p2: { p3 }}} of [{p1: {p2: {p3: 'value'}}}]) {}
for (const {p1: {p2: { p3: [key] }}} of [{p1: {p2: {p3: ['value']}}}]) {} const [[[{ key }]]]: [[[{ key: string }]]] = [[[{ key: 'value' }]]] Taken from #1570 (comment) |
The rule
@typescript-eslint/typedef
witharrayDestructuring
options tell me to annotate the type insidefor/of
statement:However, it's impossible in TypeScript:
It's required to define the exclusion for
for/of
(and, I suppose,for/in
) statements.What did you expect to happen?
Row
for (const [ key, value ] of Object.entries(test)) {
does not break the rule 'typedef/arrayDestructuring' because it's impossible to annotate types here in TypeScript.What actually happened?
It is.
Versions
@typescript-eslint/eslint-plugin
2.19.0
(newest for the moment when I opened this issue)@typescript-eslint/parser
2.19.0
(newest for the moment when I opened this issue)@typescript-eslint/typescript-estree
2.19.0
@typescript-eslint/experimental-utils
2.19.0
TypeScript
3.7.5
(newest for the moment when I opened this issue)node
12.14.1
npm
6.3.14
The text was updated successfully, but these errors were encountered: