Closed
Description
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 |
armano2 and glen-84
Metadata
Metadata
Assignees
Labels
Go ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueSomething isn't workingSomething isn't workingIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin