Skip to main content
Module

x/valibot/mod.ts>getDefaults

The modular and type safe schema library for validating structural data 🤖
Extremely Popular
Go to Latest
function getDefaults
import { getDefaults } from "https://deno.land/x/valibot@v0.28.1/mod.ts";

Returns the default values of the schema.

Hint: The difference to getDefault 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>>

Parameters

schema: TSchema

The schema to get the default values from.

Returns

DefaultValues<TSchema>

The default values.