For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/function/callAsync.md.

callAsync

Invokes a function returning a Promise with the provided arguments.

Async-typed sibling of call — equivalent to fn(...args) for promise-returning functions, but the signature constrains the return to Promise<R> so it composes cleanly inside async pipelines.

const user = await callAsync(fetchUser, 'user-123')

Usage

callAsync<A extends readonly unknown[], R>(fn: (...args: A) => Promise<R>, ...args: A)

Invokes a function returning a Promise with the provided arguments.

Async-typed sibling of call — equivalent to fn(...args) for promise-returning functions, but the signature constrains the return to Promise<R> so it composes cleanly inside async pipelines.

import { callAsync } from 'massaman'
// or:  import { callAsync } from 'massaman/function'

const user = await callAsync(fetchUser, 'user-123')

Parameters

fn(...args: A) => Promise<R>required

the async function to invoke.

argsArequired

the arguments passed to fn.

Returns

the promise returned by fn.

Promise<R>