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
{
"rules": {
"@typescript-eslint/strict-boolean-expressions": [
"warn",
{
"allowString": true,
"allowNumber": true,
"allowNullableObject": true,
"allowNullableBoolean": true,
"allowNullableNumber": false,
"allowNullableString": true,
"allowAny": false
}
],
}
}
function foo(value?: boolean | { prop: any }) {
if (value) {
// value above errors with "Unexpected value in conditional. A boolean expression is required."
}
}
tsconfig.json
{
"compilerOptions": {
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"lib": ["es2019"],
"module": "esnext",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": false,
"outDir": "dist",
"resolveJsonModule": true,
"rootDir": "src",
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es2019"
}
}
Expected Result
No error on the if (value) {
line
Actual Result
"Unexpected value in conditional. A boolean expression is required." on the if (value) {
line
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
4.10.0 |
@typescript-eslint/parser |
4.10.0 |
TypeScript |
4.0.5 |
ESLint |
7.16.0 |
node |
12.16.2 |