API reference › @evolu/common › Type › nullishOr
function nullishOr<ValueType>(
type: ValidateUnionTypeMember<ValueType>,
): UnionType<readonly [ValueType, LiteralType<null>, LiteralType<undefined>]>;
Defined in: packages/common/src/Type.ts:3768
Union Type containing the supplied Type, null, and undefined.
Example
import { assertOk, String, nullishOr } from "@evolu/common";
const NullishString = nullishOr(String);
assertOk(NullishString.fromUnknown(undefined), undefined);
assertOk(NullishString.fromUnknown(null), null);