Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/valibot/mod.ts>getFallbacksAsync

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

Returns the fallback values of the schema.

Hint: The difference to getFallbackAsync is that for objects and tuples without an explicit fallback value, this function recursively returns the fallback values of the subschemas instead of undefined.

Type Parameters

TSchema extends SchemaWithMaybeFallback<BaseSchema | ObjectSchema<ObjectEntries, any> | TupleSchema<TupleItems, any>> | SchemaWithMaybeFallbackAsync<BaseSchemaAsync | ObjectSchemaAsync<ObjectEntriesAsync, any> | TupleSchemaAsync<TupleItemsAsync, any>>

Parameters

schema: TSchema

The schema to get the fallback values from.

Returns

Promise<FallbackValues<TSchema>>

The fallback values.