Skip to content

Function.partial

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

umt / partial

Function: partial()

partial<T>(validator, message?): (value) => ValidateCoreReturnType<InferObject<PartialShape<T>>> & object & StandardSchemaV1<InferObject<PartialShape<T>>, InferObject<PartialShape<T>>>

Defined in: Validate/object/partial.ts:38

Wraps every property validator of validator with optional(). Validators that are already optional are kept as-is so the wrapper stays idempotent.

Type Parameters

T

T extends ObjectShape

Original object shape

Parameters

validator

ObjectValidator<T>

Source object validator

message?

string

Custom error message for the new validator

Returns

(value) => ValidateCoreReturnType<InferObject<PartialShape<T>>> & object & StandardSchemaV1<InferObject<PartialShape<T>>, InferObject<PartialShape<T>>>

  • New validator where every key accepts undefined

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally