# forwardAsync

> This document is the Markdown version of [valibot.dev/api/forwardAsync/](https://valibot.dev/api/forwardAsync/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Forwards the issues of the passed validation action.

```ts
const Action = v.forwardAsync<TInput, TIssue, TPath>(action, path);
```

## Generics

- `TInput` `extends Record<string, unknown> | ArrayLike<unknown>`
- `TIssue` `extends BaseIssue<unknown>`
- `TPath` `extends RequiredPath`

## Parameters

- `action` `BaseValidation<TInput, TInput, TIssue> | BaseValidationAsync<TInput, TInput, TIssue>`
- `path` `ValidPath<TInput, TPath>`

### Explanation

`forwardAsync` allows you to forward the issues of the passed validation `action` via `path` to a nested field of a schema.

## Returns

- `Action` `BaseValidationAsync<TInput, TInput, TIssue>`

## Examples

The following examples show how `forwardAsync` can be used.

### Allowed action schema

Schema that checks if the user is allowed to complete an action.

```ts
import { isAllowedAction, isUsernamePresent } from '~/api';

const AllowedActionSchema = v.pipeAsync(
  v.objectAsync({
    username: v.pipeAsync(
      v.string(),
      v.minLength(3),
      v.checkAsync(isUsernamePresent, 'The username is not in the database.')
    ),
    action: v.picklist(['view', 'edit', 'delete']),
  }),
  v.forwardAsync(
    v.checkAsync(
      isAllowedAction,
      'The user is not allowed to complete the action.'
    ),
    ['action']
  )
);
```

## Related

The following APIs can be combined with `forwardAsync`.

### Schemas

[`any`](/api/any.md), [`array`](/api/array.md), [`custom`](/api/custom.md), [`looseObject`](/api/looseObject.md), [`looseTuple`](/api/looseTuple.md), [`object`](/api/object.md), [`objectWithRest`](/api/objectWithRest.md), [`record`](/api/record.md), [`strictObject`](/api/strictObject.md), [`strictTuple`](/api/strictTuple.md), [`tuple`](/api/tuple.md), [`tupleWithRest`](/api/tupleWithRest.md), [`union`](/api/union.md), [`unknown`](/api/unknown.md), [`variant`](/api/variant.md)

### Methods

[`omit`](/api/omit.md), [`pick`](/api/pick.md)

### Actions

[`check`](/api/check.md), [`checkItems`](/api/checkItems.md), [`empty`](/api/empty.md), [`everyItem`](/api/everyItem.md), [`excludes`](/api/excludes.md), [`filterItems`](/api/filterItems.md), [`findItem`](/api/findItem.md), [`guard`](/api/guard.md), [`includes`](/api/includes.md), [`length`](/api/length.md), [`mapItems`](/api/mapItems.md), [`maxLength`](/api/maxLength.md), [`metadata`](/api/metadata.md), [`minLength`](/api/minLength.md), [`nonEmpty`](/api/nonEmpty.md), [`notLength`](/api/notLength.md), [`partialCheck`](/api/partialCheck.md), [`rawCheck`](/api/rawCheck.md), [`reduceItems`](/api/reduceItems.md), [`someItem`](/api/someItem.md), [`sortItems`](/api/sortItems.md)

### Utils

[`isOfKind`](/api/isOfKind.md), [`isOfType`](/api/isOfType.md)

### Async

[`arrayAsync`](/api/arrayAsync.md), [`awaitAsync`](/api/awaitAsync.md), [`checkAsync`](/api/checkAsync.md), [`customAsync`](/api/customAsync.md), [`looseObjectAsync`](/api/looseObjectAsync.md), [`looseTupleAsync`](/api/looseTupleAsync.md), [`objectAsync`](/api/objectAsync.md), [`objectWithRestAsync`](/api/objectWithRestAsync.md), [`partialAsync`](/api/partialAsync.md), [`partialCheckAsync`](/api/partialCheckAsync.md), [`rawCheckAsync`](/api/rawCheckAsync.md), [`recordAsync`](/api/recordAsync.md), [`requiredAsync`](/api/requiredAsync.md), [`strictObjectAsync`](/api/strictObjectAsync.md), [`strictTupleAsync`](/api/strictTupleAsync.md), [`tupleAsync`](/api/tupleAsync.md), [`tupleWithRestAsync`](/api/tupleWithRestAsync.md), [`unionAsync`](/api/unionAsync.md), [`variantAsync`](/api/variantAsync.md)
