Skip to content

Nullish

Adds null and undefined to a type (T | null | undefined).

Alias of Maybe.

Available since v3.0.0

import type { Nullish } from '@helpers4/type';
// or, from the all-in-one package (same code, one install):
import type { Nullish } from 'helpers4/type';
type Nullish<T> = Maybe<T>
type OptionalUser = Nullish<User>; // User | null | undefined

View source on GitHub