Aller au contenu principal

keyof()

keyof<T>(objectSchema, message?): KeyofSchema<ObjectSchema<T>>

Keyof schema - validates that the value is a key of an object.


Type Parameters

T: T extends Record<string, GenericSchema>


Parameters

objectSchema: ObjectSchema<T> | ObjectConstraint<T> | { entries: T; }

Object schema whose keys to validate.

message?: string

Custom error message.


Returns: KeyofSchema<ObjectSchema<T>>

Schema that validates the object keys.


Since

2.0.0