Skip to content

TypeAlias.OptionalValidator

github-actions[bot] edited this page Jul 8, 2026 · 29 revisions

umt / OptionalValidator

Type Alias: OptionalValidator<T, R>

OptionalValidator<T, R> = (value?) => R | UndefinedReturn & object

Defined in: Validate/object/optional.ts:18

Optional validator augmented with a reference to the wrapped validator, used by required() to unwrap optional layers when rebuilding a shape

Type Declaration

inner

inner: (value) => R

Parameters

value

T

Returns

R

isOptional

isOptional: true

Type Parameters

T

T

The type of value the wrapped validator expects

R

R extends object = { message: string; type: unknown; validate: boolean; }

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

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally