diff --git a/website/src/routes/api/(async)/nullableAsync/index.mdx b/website/src/routes/api/(async)/nullableAsync/index.mdx index 1a2427ca4..24b30fac9 100644 --- a/website/src/routes/api/(async)/nullableAsync/index.mdx +++ b/website/src/routes/api/(async)/nullableAsync/index.mdx @@ -11,4 +11,13 @@ import { properties } from './properties'; # nullableAsync -> The content of this page is not yet ready. Until then, please use the [source code](https://github.com/fabian-hiller/valibot/blob/main/library/src/schemas/nullable/nullableAsync.ts) or take a look at [issue #287](https://github.com/fabian-hiller/valibot/issues/287) to help us extend the API reference. +Creates a nullable schema. + +```ts +const Schema = v.nullableAsync(wrapped, default); +``` + +## Generics + +- `TWrapped` +- `TDefault` diff --git a/website/src/routes/api/(async)/nullableAsync/properties.ts b/website/src/routes/api/(async)/nullableAsync/properties.ts index 3b209b02d..7604b810e 100644 --- a/website/src/routes/api/(async)/nullableAsync/properties.ts +++ b/website/src/routes/api/(async)/nullableAsync/properties.ts @@ -1,130 +1,141 @@ import type { PropertyProps } from '~/components'; export const properties: Record = { - TKey: { + TWrapped: { modifier: 'extends', type: { - type: 'union', - options: [ + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'unknown', + 'unknown', { type: 'custom', - name: 'BaseSchema', - href: '../BaseSchema/', - generics: [ - 'unknown', - 'unknown', - { - type: 'custom', - name: 'BaseIssue', - href: '../BaseIssue/', - generics: ['unknown'], - }, - ], + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], }, + ], + }, + }, + TDefault: { + modifier: 'extends', + type: { + type: 'custom', + name: 'Default', + href: '../Default/', + generics: [ { type: 'custom', - name: 'BaseSchemaAsync', - href: '../BaseSchemaAsync/', - generics: [ - 'unknown', - 'unknown', - { - type: 'custom', - name: 'BaseIssue', - href: '../BaseIssue/', - generics: ['unknown'], - }, - ], + name: 'TWrapped', }, + 'undefined', ], }, }, - TValue: { + BaseSchema: { modifier: 'extends', type: { - type: 'union', - options: [ + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ { - type: 'custom', - name: 'BaseSchema', - href: '../BaseSchema/', - generics: [ - 'unknown', - 'unknown', + type: 'union', + options: [ { type: 'custom', - name: 'BaseIssue', - href: '../BaseIssue/', - generics: ['unknown'], + name: 'InferInput', + href: '../InferInput/', + generics: [ + { + type: 'custom', + name: 'TWrapped', + }, + ], }, + 'undefined', ], }, { type: 'custom', - name: 'BaseSchemaAsync', - href: '../BaseSchemaAsync/', + name: 'InferOptionalOutput', + href: '../InferOptionalOutput/', generics: [ - 'unknown', - 'unknown', { type: 'custom', - name: 'BaseIssue', - href: '../BaseIssue/', - generics: ['unknown'], + name: 'TWrapped', + }, + { + type: 'custom', + name: 'TDefault', }, ], }, - ], - }, - }, - TDefault: { - modifier: 'extends', - type: { - type: 'custom', - name: 'Default', - href: '../Default/', - generics: [ { type: 'custom', - name: 'TWrapped', + name: 'InferIssue', + href: '../InferIssue/', + generics: [ + { + type: 'custom', + name: 'TWrapped', + }, + ], }, - 'undefined', ], }, }, - key: { - type: { - type: 'custom', - name: 'TKey', - }, - }, - value: { + type: { type: { - type: 'custom', - name: 'TValue', + type: 'string', + value: 'optional', }, }, - message: { + reference: { type: { type: 'custom', - name: 'TMessage', + modifier: 'typeof', + name: 'optional', + href: '../optional/', }, }, - Schema: { + expects: { type: { - type: 'custom', - name: 'nullableAsync', - href: '../nullableAsync/', - generics: [ + type: 'template', + parts: [ + { + type: 'string', + value: '(', + }, { type: 'custom', name: 'TWrapped', + indexes: [ + { + type: 'string', + value: 'expects', + }, + ], }, { - type: 'custom', - name: 'TDefault', + type: 'string', + value: ' | undefined)', }, ], }, }, + wrapped: { + type: { + type: 'custom', + name: 'TWrapped', + }, + }, + default: { + type: { + type: 'custom', + name: 'TDefault', + }, + }, }; diff --git a/website/src/routes/api/(async)/nullishAsync/index.mdx b/website/src/routes/api/(async)/nullishAsync/index.mdx index 15df3ca05..c56caec51 100644 --- a/website/src/routes/api/(async)/nullishAsync/index.mdx +++ b/website/src/routes/api/(async)/nullishAsync/index.mdx @@ -11,4 +11,13 @@ import { properties } from './properties'; # nullishAsync -> The content of this page is not yet ready. Until then, please use the [source code](https://github.com/fabian-hiller/valibot/blob/main/library/src/schemas/nullish/nullishAsync.ts) or take a look at [issue #287](https://github.com/fabian-hiller/valibot/issues/287) to help us extend the API reference. +Creates a nullish schema. + +```ts +const Schema = v.nullishAsync(wrapped, default); +``` + +## Generics + +- `TWrapped` +- `TDefault` diff --git a/website/src/routes/api/(async)/nullishAsync/properties.ts b/website/src/routes/api/(async)/nullishAsync/properties.ts index 3b209b02d..7604b810e 100644 --- a/website/src/routes/api/(async)/nullishAsync/properties.ts +++ b/website/src/routes/api/(async)/nullishAsync/properties.ts @@ -1,130 +1,141 @@ import type { PropertyProps } from '~/components'; export const properties: Record = { - TKey: { + TWrapped: { modifier: 'extends', type: { - type: 'union', - options: [ + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'unknown', + 'unknown', { type: 'custom', - name: 'BaseSchema', - href: '../BaseSchema/', - generics: [ - 'unknown', - 'unknown', - { - type: 'custom', - name: 'BaseIssue', - href: '../BaseIssue/', - generics: ['unknown'], - }, - ], + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], }, + ], + }, + }, + TDefault: { + modifier: 'extends', + type: { + type: 'custom', + name: 'Default', + href: '../Default/', + generics: [ { type: 'custom', - name: 'BaseSchemaAsync', - href: '../BaseSchemaAsync/', - generics: [ - 'unknown', - 'unknown', - { - type: 'custom', - name: 'BaseIssue', - href: '../BaseIssue/', - generics: ['unknown'], - }, - ], + name: 'TWrapped', }, + 'undefined', ], }, }, - TValue: { + BaseSchema: { modifier: 'extends', type: { - type: 'union', - options: [ + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ { - type: 'custom', - name: 'BaseSchema', - href: '../BaseSchema/', - generics: [ - 'unknown', - 'unknown', + type: 'union', + options: [ { type: 'custom', - name: 'BaseIssue', - href: '../BaseIssue/', - generics: ['unknown'], + name: 'InferInput', + href: '../InferInput/', + generics: [ + { + type: 'custom', + name: 'TWrapped', + }, + ], }, + 'undefined', ], }, { type: 'custom', - name: 'BaseSchemaAsync', - href: '../BaseSchemaAsync/', + name: 'InferOptionalOutput', + href: '../InferOptionalOutput/', generics: [ - 'unknown', - 'unknown', { type: 'custom', - name: 'BaseIssue', - href: '../BaseIssue/', - generics: ['unknown'], + name: 'TWrapped', + }, + { + type: 'custom', + name: 'TDefault', }, ], }, - ], - }, - }, - TDefault: { - modifier: 'extends', - type: { - type: 'custom', - name: 'Default', - href: '../Default/', - generics: [ { type: 'custom', - name: 'TWrapped', + name: 'InferIssue', + href: '../InferIssue/', + generics: [ + { + type: 'custom', + name: 'TWrapped', + }, + ], }, - 'undefined', ], }, }, - key: { - type: { - type: 'custom', - name: 'TKey', - }, - }, - value: { + type: { type: { - type: 'custom', - name: 'TValue', + type: 'string', + value: 'optional', }, }, - message: { + reference: { type: { type: 'custom', - name: 'TMessage', + modifier: 'typeof', + name: 'optional', + href: '../optional/', }, }, - Schema: { + expects: { type: { - type: 'custom', - name: 'nullableAsync', - href: '../nullableAsync/', - generics: [ + type: 'template', + parts: [ + { + type: 'string', + value: '(', + }, { type: 'custom', name: 'TWrapped', + indexes: [ + { + type: 'string', + value: 'expects', + }, + ], }, { - type: 'custom', - name: 'TDefault', + type: 'string', + value: ' | undefined)', }, ], }, }, + wrapped: { + type: { + type: 'custom', + name: 'TWrapped', + }, + }, + default: { + type: { + type: 'custom', + name: 'TDefault', + }, + }, };