Closed
Description
The rule option ignoreRhs
should be enabled. This is an error I had which is gone with the option enabled:
interface Foo {
bar?: string[];
}
const obj: Foo = {};
const alwaysArray = obj.bar || [];
With message 6:32 Unnecessary conditional, value is always truthy.
which marks the array on the right side as unnecessary condition as []
is always true. Which is exactly what I want in this case.
Metadata
Metadata
Assignees
Labels
No labels