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

x/valibot/src/methods/index.ts>fallbackAsync

The modular and type safe schema library for validating structural data 🤖
Latest
function fallbackAsync
import { fallbackAsync } from "https://deno.land/x/valibot@v1.0.0-beta.7/src/methods/index.ts";

Returns a fallback value as output if the input does not match the schema.

Type Parameters

TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>
TFallback extends FallbackAsync<TSchema>

Parameters

schema: TSchema

The schema to catch.

fallback: TFallback

The fallback value.