Spec-Zone.ru › Valibot

awaitAsync

Creates an await transformation action.

const Action = v.awaitAsync<TInput>();

Generics

  • TInput extends Promise<unknown>

Explanation

With awaitAsync you can transform a promise into its resolved value.

Returns

  • Action AwaitActionAsync<TInput>

Examples

The following examples show how awaitAsync can be used.

Unique emails schema

Schema to check a set of emails wrapped in a promise object.

const UniqueEmailsSchema = v.pipeAsync(
  v.promise(),
  v.awaitAsync(),
  v.set(v.pipe(v.string(), v.email()))
);

Related

The following APIs can be combined with awaitAsync.

Schemas

any, array, bigint, blob, boolean, custom, date, enum, exactOptional, file, function, instance, intersect, lazy, literal, looseObject, looseTuple, map, nan, never, nonNullable, nonNullish, nonOptional, null, nullable, nullish, number, object, objectWithRest, optional, picklist, promise, record, set, strictObject, strictTuple, string, symbol, tuple, tupleWithRest, undefined, undefinedable, union, unknown, variant, void

Utils

isOfKind, isOfType

Async

arrayAsync, customAsync, exactOptionalAsync, intersectAsync, lazyAsync, looseObjectAsync, looseTupleAsync, mapAsync, nonNullableAsync, nonNullishAsync, nonOptionalAsync, nullableAsync, nullishAsync, objectAsync, objectWithRestAsync, optionalAsync, pipeAsync, recordAsync, setAsync, strictObjectAsync, strictTupleAsync, tupleAsync, tupleWithRestAsync, unionAsync, variantAsync

© Fabian Hiller
Licensed under the MIT License.
https://valibot.dev/api/awaitAsync/

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API