Repro
{
"rules": {
"@typescript-eslint/prefer-optional-chain": ["error"]
}
}
declare const a: { b: string | null } | null;
a !== null && a.b !== null && a.b.length > 0;
/*
^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using an optional chain expression instead, as it's more concise and easier to read.
*/
Expected Result
a?.b != null && a.b.length > 0;
Actual Result
a?.b !== null && a.b.length > 0;
/*
^ Object is possibly 'null'.
*/
Additional Info
Versions
| package |
version |
@typescript-eslint/eslint-plugin |
2.15.0 |
@typescript-eslint/parser |
2.15.0 |
TypeScript |
3.7.3 |
ESLint |
6.1.0 |
node |
10.16.0 |
npm |
6.9.0 |
Repro
{ "rules": { "@typescript-eslint/prefer-optional-chain": ["error"] } }Expected Result
Actual Result
Additional Info
Versions
@typescript-eslint/eslint-plugin2.15.0@typescript-eslint/parser2.15.0TypeScript3.7.3ESLint6.1.0node10.16.0npm6.9.0