Skip to content

Function.nullable

github-actions[bot] edited this page Jun 2, 2026 · 32 revisions

umt / nullable

Function: nullable()

nullable<T, R>(validator): (value) => NullReturn | R & StandardSchemaV1<T | null, T | null>

Defined in: Validate/object/nullable.ts:19

Wraps a validator to accept null values

Type Parameters

T

T

The type of value the wrapped validator expects

R

R extends object

The return type of the wrapped validator (preserved so the inner type tag flows through)

Parameters

validator

(value) => R

Validator function to make nullable

Returns

(value) => NullReturn | R & StandardSchemaV1<T | null, T | null>

  • Validator that passes for null or delegates to the wrapped validator

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally