---
title: partialCheckAsync
description: Creates a partial check validation action.
source: /actions/partialCheck/partialCheckAsync.ts
contributors:
  - fabian-hiller
  - EltonLobo07
---

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

# partialCheckAsync

Creates a partial check validation action.

```ts
const Action = v.partialCheckAsync<TInput, TPaths, TSelection, TMessage>(
  paths,
  requirement,
  message
);
```

## Generics

- `TInput` <Property {...properties.TInput} />
- `TPaths` <Property {...properties.TPaths} />
- `TSelection` <Property {...properties.TSelection} />
- `TMessage` <Property {...properties.TMessage} />

## Parameters

- `paths` <Property {...properties.paths} />
- `requirement` <Property {...properties.requirement} />
- `message` <Property {...properties.message} />

### Explanation

With `partialCheckAsync` you can freely validate the selected input and return `true` if it is valid or `false` otherwise. If the input does not match your `requirement`, you can use `message` to customize the error message.

> The difference to <Link href='../checkAsync/'>`checkAsync`</Link> is that `partialCheckAsync` can be executed whenever the selected part of the data is valid, while <Link href='../checkAsync/'>`checkAsync`</Link> is executed only when the entire dataset is typed. This can be an important advantage when working with forms.

## Returns

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

## Examples

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

### Message details schema

Schema to validate details associated with a message.

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

const MessageDetailsSchema = v.pipeAsync(
  v.object({
    sender: v.object({
      name: v.pipe(v.string(), v.minLength(2), v.maxLength(45)),
      email: v.pipe(v.string(), v.email()),
    }),
    groupId: v.pipe(v.string(), v.uuid()),
    message: v.pipe(v.string(), v.nonEmpty(), v.maxLength(500)),
  }),
  v.forwardAsync(
    v.partialCheckAsync(
      [['sender', 'email'], ['groupId']],
      (input) =>
        isSenderInTheGroup({
          senderEmail: input.sender.email,
          groupId: input.groupId,
        }),
      'The sender is not in the group.'
    ),
    ['sender', 'email']
  )
);
```

## Related

The following APIs can be combined with `partialCheckAsync`.

### Schemas

<ApiList
  items={[
    'any',
    'array',
    'custom',
    'instance',
    'intersect',
    'lazy',
    'looseObject',
    'looseTuple',
    'nonNullable',
    'nonNullish',
    'nonOptional',
    'object',
    'objectWithRest',
    'record',
    'strictObject',
    'strictTuple',
    'tuple',
    'tupleWithRest',
    'union',
    'variant',
  ]}
/>

### Utils

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

### Async

<ApiList
  items={[
    'arrayAsync',
    'awaitAsync',
    'customAsync',
    'forwardAsync',
    'intersectAsync',
    'lazyAsync',
    'looseObjectAsync',
    'looseTupleAsync',
    'nonNullableAsync',
    'nonNullishAsync',
    'nonOptionalAsync',
    'objectAsync',
    'objectWithRestAsync',
    'pipeAsync',
    'recordAsync',
    'strictObjectAsync',
    'strictTupleAsync',
    'tupleAsync',
    'tupleWithRestAsync',
    'unionAsync',
    'variantAsync',
  ]}
/>
