# partialCheckAsync

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

Creates a partial check validation action.

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

## Generics

- `TInput` `extends PartialInput`
- `TPaths` `extends RequiredPaths`
- `TSelection` `extends DeepPickN<TInput, TPaths>`
- `TMessage` `extends ErrorMessage<PartialCheckIssue<TSelection>> | undefined`

## Parameters

- `paths` `ValidPaths<TInput, TPaths>`
- `requirement` `(input: TSelection) => MaybePromise<boolean>`
- `message` `TMessage`

### 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 [`checkAsync`](/api/checkAsync.md) is that `partialCheckAsync` can be executed whenever the selected part of the data is valid, while [`checkAsync`](/api/checkAsync.md) is executed only when the entire dataset is typed. This can be an important advantage when working with forms.

## Returns

- `Action` `PartialCheckActionAsync<TInput, TPaths, TSelection, TMessage>`

## 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

[`any`](/api/any.md), [`array`](/api/array.md), [`custom`](/api/custom.md), [`instance`](/api/instance.md), [`intersect`](/api/intersect.md), [`lazy`](/api/lazy.md), [`looseObject`](/api/looseObject.md), [`looseTuple`](/api/looseTuple.md), [`nonNullable`](/api/nonNullable.md), [`nonNullish`](/api/nonNullish.md), [`nonOptional`](/api/nonOptional.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), [`variant`](/api/variant.md)

### Utils

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

### Async

[`arrayAsync`](/api/arrayAsync.md), [`awaitAsync`](/api/awaitAsync.md), [`customAsync`](/api/customAsync.md), [`forwardAsync`](/api/forwardAsync.md), [`intersectAsync`](/api/intersectAsync.md), [`lazyAsync`](/api/lazyAsync.md), [`looseObjectAsync`](/api/looseObjectAsync.md), [`looseTupleAsync`](/api/looseTupleAsync.md), [`nonNullableAsync`](/api/nonNullableAsync.md), [`nonNullishAsync`](/api/nonNullishAsync.md), [`nonOptionalAsync`](/api/nonOptionalAsync.md), [`objectAsync`](/api/objectAsync.md), [`objectWithRestAsync`](/api/objectWithRestAsync.md), [`pipeAsync`](/api/pipeAsync.md), [`recordAsync`](/api/recordAsync.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)
