Skip to main content

pick()

pick<T, K>(schema, keys, message?): PickSchema<ObjectSchema<T>, K>

Pick transform - selects specific properties.


Type Parametersโ€‹

T: T extends Record<string, GenericSchema>โ€‹

K: K extends string | number | symbolโ€‹


Parametersโ€‹

schema: ObjectSchema<T> | ObjectConstraint<T> | { entries: T; }โ€‹

Source object schema.

keys: readonly K[]โ€‹

Keys to select.

message?: stringโ€‹

Custom error message.


Returns: PickSchema<ObjectSchema<T>, K>โ€‹

Schema with only selected properties.


Sinceโ€‹

2.0.0