Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/valibot/src/index.ts>getFallbacks

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

Returns the fallback values of the schema.

Hint: The difference to getFallback is that for object and tuple schemas this function recursively returns the fallback values of the subschemas instead of undefined.

Type Parameters

TSchema extends
| BaseSchema<unknown, unknown, BaseIssue<unknown>>
| LooseObjectSchema<ObjectEntries, ErrorMessage<LooseObjectIssue> | undefined>
| LooseTupleSchema<TupleItems, ErrorMessage<LooseTupleIssue> | undefined>
| ObjectSchema<ObjectEntries, ErrorMessage<ObjectIssue> | undefined>
| ObjectWithRestSchema<ObjectEntries, BaseSchema<unknown, unknown, BaseIssue<unknown>>, ErrorMessage<ObjectWithRestIssue> | undefined>
| StrictObjectSchema<ObjectEntries, ErrorMessage<StrictObjectIssue> | undefined>
| StrictTupleSchema<TupleItems, ErrorMessage<StrictTupleIssue> | undefined>
| TupleSchema<TupleItems, ErrorMessage<TupleIssue> | undefined>
| TupleWithRestSchema<TupleItems, BaseSchema<unknown, unknown, BaseIssue<unknown>>, ErrorMessage<TupleWithRestIssue> | undefined>

Parameters

schema: TSchema

The schema to get them from.

Returns

InferFallbacks<TSchema>

The fallback values.