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