---
title: argsAsync
description: Creates a function arguments transformation action.
source: /actions/args/argsAsync.ts
contributors:
  - fabian-hiller
---

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

# argsAsync

Creates a function arguments transformation action.

```ts
const Action = v.argsAsync<TInput, TSchema>(schema);
```

## Generics

- `TInput` <Property {...properties.TInput} />
- `TSchema` <Property {...properties.TSchema} />

## Parameters

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

### Explanation

With `argsAsync` you can force the arguments of a function to match the given `schema`.

## Returns

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

## Examples

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

### Product function schema

Schema of a function that returns a product by its ID.

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

const ProductFunctionSchema = v.pipeAsync(
  v.function(),
  v.argsAsync(
    v.tupleAsync([v.pipeAsync(v.string(), v.checkAsync(isValidProductId))])
  ),
  v.returnsAsync(
    v.pipeAsync(
      v.promise(),
      v.awaitAsync(),
      v.object({
        id: v.string(),
        name: v.string(),
        price: v.number(),
      })
    )
  )
);
```

## Related

The following APIs can be combined with `argsAsync`.

### Schemas

<ApiList
  items={[
    'any',
    'custom',
    'looseTuple',
    'function',
    'strictTuple',
    'tuple',
    'tupleWithRest',
  ]}
/>

### Methods

<ApiList items={['pipe']} />

### Utils

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

### Async

<ApiList
  items={[
    'customAsync',
    'looseTupleAsync',
    'pipeAsync',
    'returnsAsync',
    'strictTupleAsync',
    'tupleAsync',
    'tupleWithRestAsync',
  ]}
/>
