nullable

View Source

Summary

Allow null as an input value, short-circuiting validation when null is provided.

Signature

function nullable<input, output>(
  schema: Schema<input, output>,
): Schema<input | null, output | null>;

Params

schema

The wrapped schema

Returns

A schema that accepts null in addition to the wrapped schema