TS2367
error TS2367: This condition will always return ‘false’ since the types ‘{ message: string; }[] | undefined’ and ‘number’ have no overlap.
Broken Code ❌
1 |
|
Fixed Code ✔️
An array cannot be 0
, so doing a check for equality with 0
makes no sense. What may be useful instead is checking the array length:
1 |
|