Skip to content

Function.record

github-actions[bot] edited this page Nov 18, 2026 · 13 revisions

umt / record

Function: record()

record<KV, VV>(keyValidator, valueValidator, message?): ((value) => ValidateCoreReturnType<RecordInfer<KV, VV>>) & StandardSchemaV1<RecordInfer<KV, VV>, RecordInfer<KV, VV>>

Defined in: Validate/object/record.ts:44

Creates a record validator for dictionary objects with dynamic keys. Every own enumerable key (as returned by Object.keys) is validated with keyValidator, then its value with valueValidator; iteration short-circuits at the first failure and surfaces the failing message.

Type Parameters

KV

KV extends RecordEntryValidator

Validator applied to every key

VV

VV extends RecordEntryValidator

Validator applied to every value

Parameters

keyValidator

KV

Validator applied to every key (e.g. string() or oneOf())

valueValidator

VV

Validator applied to every value

message?

string = ""

Custom error message when the value is not a dictionary object

Returns

((value) => ValidateCoreReturnType<RecordInfer<KV, VV>>) & StandardSchemaV1<RecordInfer<KV, VV>, RecordInfer<KV, VV>>

  • Validator function for dictionary objects whose entries satisfy both validators

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally