Closed
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have read the FAQ and my problem is not listed.
Repro
// ESLint says: 'num' is never reassigned. Use 'const' instead.
let num = data?.a
num! = 1
// same thing happens with +=, -=, etc
{
"rules": {
"prefer-const": "error"
}
}
// your repro code case
let xp = data?.xp;
/* bunch of unrelated code ... */
xp! = 123;
Expected Result
Nothing, since num
is being reassigned
Actual Result
ESLint says 'xp' is never reassigned. Use 'const' instead.
Additional Info
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
4.6.0 |
@typescript-eslint/parser |
4.6.0 |
TypeScript |
4.1.2 |
ESLint |
7.14.0 |
node |
14.14.0 |