> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# flattenDeep (Functional Programming) es-toolkit

Creates a function that recursively flattens nested arrays. Use it with [`pipe`](https://massaman.dev/reference/fp/pipe.md).

```typescript
const result = pipe(array, flattenDeep());
```

::: info

Prefer the original es-toolkit [`flattenDeep`](https://massaman.dev/reference/array/flattenDeep.md) in ordinary code. Use this `fp` variant when composing transformations with [`pipe`](https://massaman.dev/reference/fp/pipe.md).

:::

## Usage

`flattenDeep` recursively removes every nested array layer from the piped array. It is lazy-capable inside [`pipe`](https://massaman.dev/reference/fp/pipe.md).

```typescript
import { flattenDeep, pipe } from 'es-toolkit/fp';

pipe([1, [2, [3, [4]]]], flattenDeep()); // => [1, 2, 3, 4]
```

#### Parameters

This function takes no arguments; call it as `flattenDeep()`.

#### Returns

A function that maps a nested array to a deeply flattened array.

```typescript
(array: readonly T[]) => Array<ExtractNestedArrayType<T>>
```


Source: es-toolkit

Re-exported verbatim from [`es-toolkit`](https://es-toolkit.dev/fp/reference/flattenDeep.html). Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.
