import { getFallbacksAsync } from "https://deno.land/x/valibot@v1.0.0-beta.2-to-json-schema/src/methods/getFallbacks/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
| ObjectWithRestSchema<ObjectEntries, BaseSchema<unknown, unknown, BaseIssue<unknown>>, ErrorMessage<ObjectWithRestIssue> | undefined>
| ObjectWithRestSchemaAsync<ObjectEntriesAsync, BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, ErrorMessage<ObjectWithRestIssue> | undefined>
| TupleWithRestSchema<TupleItems, BaseSchema<unknown, unknown, BaseIssue<unknown>>, ErrorMessage<TupleWithRestIssue> | undefined>
| TupleWithRestSchemaAsync<TupleItemsAsync, BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, ErrorMessage<TupleWithRestIssue> | undefined>
Parameters
schema: TSchema
The schema to get them from.
Returns
Promise<InferFallbacks<TSchema>>
The fallback values.