Type guard that checks if a value is not null or undefined (non-nullish).
This function uses the loose inequality operator (!=) to check that a value
is neither null nor undefined in a single comparison. This is equivalent
to TypeScript's NonNullable<T> utility type.
Type Narrowing Behavior:
Excludes both null and undefined from the input type when true
Equivalent to applying TypeScript's NonNullable<T> utility type
Commonly used to filter out nullish values from arrays
Type guard that checks if a value is not
null
orundefined
(non-nullish).This function uses the loose inequality operator (
!=
) to check that a value is neithernull
norundefined
in a single comparison. This is equivalent to TypeScript'sNonNullable<T>
utility type.Type Narrowing Behavior:
null
andundefined
from the input type whentrue
NonNullable<T>
utility type