diegofariasm
diegofariasm
DTDrizzle Team
Created by diegofariasm on 10/19/2023 in #help
Dealing with type safety
I am trying to do something like this: if (result.length === 0) { throw new Error(No user with id ${id} found.); } return result[0]; But typescript complains that { .... } | undefined is assignable to { ... }. How could i fix that? Should the if already deal with the case in which result is undefined?
3 replies