nullish
Nullability helpers to widen or narrow optionality.
import { isString, nullable, nonNull, nullish, optional, required } from 'is-kit';const maybeString = nullable(isString);maybeString(null); // trueconst notNull = nonNull(isString);notNull('x'); // trueconst maybe = nullish(isString);maybe(undefined); // trueconst maybeUndef = optional(isString);maybeUndef(undefined); // trueconst needValue = required(optional(isString));needValue('ok'); // true