You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Check if the parameter is assigned a value other than undefined or null.
*
* Use to improve readability and defend against common mistakes such as `if (!!x)` where it is unclear if the author intended for the check to fail when x is any falsy value such as 0 or -0, or if they intended to check the value is not nullish
*/
export function isDefined<T extends unknown>(x: T | undefined): x is T {
return x !== undefined && x !== null;
}
/**
* Check if the parameter is strictly undefined.
*
* Use to improve readability and defend against common mistakes such as `if (!x) return;` where it is unclear if the author intended to return early when x is 0 or -0
*/
export function isUndefined<T extends unknown>(
x: T | undefined,
): x is undefined {
return x === undefined;
}
type Nullish = null | undefined;
/**
* Check if the parameter is nullish
*/
export function isNullish<T>(x: T | Nullish): x is Nullish {