---
title: arrayAsync
description: Creates an array schema.
source: /schemas/array/arrayAsync.ts
contributors:
  - fabian-hiller
  - EltonLobo07
---

import { ApiList, Link, Property } from '~/components';
import { properties } from './properties';

# arrayAsync

Creates an array schema.

```ts
const Schema = v.arrayAsync<TItem, TMessage>(item, message);
```

## Generics

- `TItem` <Property {...properties.TItem} />
- `TMessage` <Property {...properties.TMessage} />

## Parameters

- `item` <Property {...properties.item} />
- `message` <Property {...properties.message} />

### Explanation

With `arrayAsync` you can validate the data type of the input. If the input is not an array, you can use `message` to customize the error message.

> If your array has a fixed length, consider using <Link href="../tupleAsync/">`tupleAsync`</Link> for a more precise typing.

## Returns

- `Schema` <Property {...properties.Schema} />

## Examples

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

### Stored emails schema

Schema to validate an array of stored emails.

```ts
import { isEmailPresent } from '~/api';

const StoredEmailsSchema = v.arrayAsync(
  v.pipeAsync(
    v.string(),
    v.email(),
    v.checkAsync(isEmailPresent, 'The email is not in the database.')
  )
);
```

## Related

The following APIs can be combined with `arrayAsync`.

### Schemas

<ApiList
  items={[
    'any',
    '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',
  ]}
/>

### Methods

<ApiList items={['config', 'getDefault', 'getFallback']} />

### Actions

<ApiList
  items={[
    'check',
    'checkItems',
    'brand',
    'description',
    'empty',
    'everyItem',
    'excludes',
    'filterItems',
    'findItem',
    'flavor',
    'guard',
    'includes',
    'length',
    'mapItems',
    'maxLength',
    'metadata',
    'minLength',
    'nonEmpty',
    'notLength',
    'partialCheck',
    'rawCheck',
    'rawTransform',
    'readonly',
    'reduceItems',
    'someItem',
    'sortItems',
    'title',
    'transform',
  ]}
/>

### Utils

<ApiList items={['entriesFromList', 'isOfKind', 'isOfType']} />

### Async

<ApiList
  items={[
    'checkAsync',
    'customAsync',
    'exactOptionalAsync',
    'fallbackAsync',
    'getDefaultsAsync',
    'getFallbacksAsync',
    'intersectAsync',
    'lazyAsync',
    'looseObjectAsync',
    'looseTupleAsync',
    'mapAsync',
    'nonNullableAsync',
    'nonNullishAsync',
    'nonOptionalAsync',
    'nullableAsync',
    'nullishAsync',
    'objectAsync',
    'objectWithRestAsync',
    'optionalAsync',
    'parseAsync',
    'parserAsync',
    'partialCheckAsync',
    'pipeAsync',
    'rawCheckAsync',
    'rawTransformAsync',
    'recordAsync',
    'safeParseAsync',
    'safeParserAsync',
    'setAsync',
    'strictObjectAsync',
    'strictTupleAsync',
    'transformAsync',
    'tupleAsync',
    'tupleWithRestAsync',
    'unionAsync',
    'variantAsync',
  ]}
/>
