import { pickAsync } from "https://deno.land/x/valibot@v0.24.0/src/methods/index.ts";
Creates an async object schema that contains only the selected keys of an existing schema.
Type Parameters
TSchema extends ObjectSchema<any, any> | ObjectSchemaAsync<any, any>
TKeys extends (keyof TSchema["entries"])[]
Returns
ObjectSchemaAsync<Pick<TSchema["entries"], TKeys[number]>>
An async object schema.
Creates an async object schema that contains only the selected keys of an existing schema.
Type Parameters
TSchema extends ObjectSchema<any, any> | ObjectSchemaAsync<any, any>
TKeys extends (keyof TSchema["entries"])[]
Parameters
schema: TSchema
The schema to pick from.
keys: TKeys
The selected keys
optional
message: ErrorMessageThe error message.
optional
pipe: PipeAsync<ObjectOutput<Pick<TSchema["entries"], TKeys[number]>, undefined>>A validation and transformation pipe.
Returns
ObjectSchemaAsync<Pick<TSchema["entries"], TKeys[number]>>
An async object schema.
Creates an async object schema that contains only the selected keys of an existing schema.
Type Parameters
TSchema extends ObjectSchema<any, any> | ObjectSchemaAsync<any, any>
TKeys extends (keyof TSchema["entries"])[]
TRest extends BaseSchema | BaseSchemaAsync | undefined
Returns
ObjectSchemaAsync<Pick<TSchema["entries"], TKeys[number]>, TRest>
An async object schema.
Creates an async object schema that contains only the selected keys of an existing schema.
Type Parameters
TSchema extends ObjectSchema<any, any> | ObjectSchemaAsync<any, any>
TKeys extends (keyof TSchema["entries"])[]
TRest extends BaseSchema | BaseSchemaAsync | undefined
Parameters
schema: TSchema
The schema to pick from.
keys: TKeys
The selected keys
rest: TRest
The object rest.
optional
message: ErrorMessageThe error message.
optional
pipe: PipeAsync<ObjectOutput<Pick<TSchema["entries"], TKeys[number]>, TRest>>A validation and transformation pipe.
Returns
ObjectSchemaAsync<Pick<TSchema["entries"], TKeys[number]>, TRest>
An async object schema.