Skip to content
Advertisement

Tag: logical-operators

Handle null >= 0 in Typescript

I have a simple check where I want to check if the given variable is >=0. The catch here is when the incoming variable has value null, then it will become truthy and log the statement. Is there a clean way to avoid it, but not adding extra checks? Answer You can employ a type guard that will assure the

Advertisement