Closed
Description
The rule @typescript-eslint/typedef
with arrayDestructuring
options tell me to annotate the type inside for/of
statement:
However, it's impossible in TypeScript:
It's required to define the exclusion for for/of
(and, I suppose, for/in
) statements.
{
"rules": {
"@typescript-eslint/typedef": [
"error",
{
"arrayDestructuring": true,
"arrowParameter": true,
"memberVariableDeclaration": true,
"objectDestructuring": true,
"parameter": true,
"propertyDeclaration": true,
"variableDeclaration": true
}
]
}
}
const test: {
alpha: string,
bravo: string
} = {
alpha: "foo",
bravo: "bar"
};
for (const [ key, value ] of Object.entries(test)) {
console.log(key);
console.log(value);
}
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
package | version |
---|---|
@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 |