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/asyncNoop.md.

asyncNoop es-toolkit

A function that asynchronously does nothing.

const promise = asyncNoop();
Info

noop function

If you need a function that synchronously does nothing, use the noop function which immediately returns void.

Usage

asyncNoop()

Use asyncNoop when you need to fill a placeholder or use as a default value where an asynchronous function is required. It returns a Promise that resolves to undefined.

import { asyncNoop } from 'es-toolkit/function';

// Example using as a default value
interface Props {
  fetchData?: () => Promise<void>;
}

function MyComponent({ fetchData = asyncNoop }: Props) {
  const handleFetchData = async () => {
    // fetchData is always a function, so it's safe to call
    await fetchData();
  };

  handleFetchData();
}

// Example of direct invocation
asyncNoop();
// Returns: Promise<void>

await asyncNoop();
// Returns: undefined

Returns

A Promise that resolves to undefined.

Promise<void>
Source: es-toolkit

Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.