Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
This
{"rules": {"@typescript-eslint/no-unnecessary-condition": ["error","ignoreRhs":true| false] }}
typeItem={type :string}functionfn(arr :Item[]) :string{// eslint complains about the optional chain on the next lineif(arr[0]?.type==="foo"){return'FOO'}return'BAR'}
Expected Result
No lint because the array item might not exist.
Actual Result
Eslint error, even though there should not be one
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 2.11.0 |
@typescript-eslint/parser | 2.12.0 |
TypeScript | 3.7.3 |
ESLint | 6.7.2 |
node | 12.13.1 |
npm | 6.12.1 |