import { getDefaultsAsync } from "https://deno.land/x/valibot@v0.30.0/src/methods/getDefaults/index.ts";
Returns the default values of the schema.
The difference to getDefaultAsync
is that for objects and tuples without
an explicit default value, this function recursively returns the default
values of the subschemas instead of undefined
.
Type Parameters
TSchema extends SchemaWithMaybeDefault<BaseSchema | ObjectSchema<ObjectEntries, any> | TupleSchema<TupleItems, any>> | SchemaWithMaybeDefaultAsync<BaseSchemaAsync | ObjectSchemaAsync<ObjectEntriesAsync, any> | TupleSchemaAsync<TupleItemsAsync, any>>
Parameters
schema: TSchema
The schema to get the default values from.
Returns
Promise<DefaultValues<TSchema> | undefined>
The default values.