export type Maybe = T | null | undefined /** * Used to test whether a `Maybe` typed value is `null` or `undefined`. * * When called, the given value's type is narrowed to `NonNullable`. * * ### Example Usage: * * ```ts * const fn = (str: Maybe) => { * if (!isNonNullable(str)) { * // typeof str = null | undefined * // ... * } * // typeof str = string * // ... * } * ``` */ export const isNonNullable = >(val?: T): val is NonNullable => typeof val !== `undefined` && val !== null