When adding the @typescript-eslint/no-unneccessary-conditions
rule, we are getting many errors on code which appears correct.
The error message seems to be incorrect too.
What am I missing?
type Foo = { foo: string }
export function myFunction(nullableThing: Foo | null) {
if (!!nullableThing) { // <-- "Unnecessary conditional, value is always falsy"
return 'foo'
} else {
return 'bar'
}
}
This was fixed as suggested by the comments - restarting the VS Code ESLint server