Closed as not planned
Closed as not planned
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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
declare const foo: string;
declare function fn(foo: string): number | undefined;
const bar = foo && fn(foo);
// ^?
const baz = bar || 84;
ESLint Config
module.exports = {
"rules": {
"@typescript-eslint/prefer-nullish-coalescing": "error"
}
}
tsconfig
Expected Result
Should not report since the expressions are not equivalent and could produce a runtime error.
Actual Result
Reports error on the last line.
Additional Info
The expresion before ||
could be something other than a nullish value (''
or 0
), so the operator shouldn't be changed to ??
.