# SimplifyDeepArray

**Kind:** Type

**Source:** [`src/utils/types.ts`](https://github.com/honojs/hono/blob/main/src/utils/types.ts#L98)

**Part of:** [Utils](subsystem-src-utils)

A simple extension of Simplify that will deeply traverse array elements.

`SimplifyDeepArray` extends `Simplify` by recursively processing array element types. It preserves the array structure while simplifying each non-array element type, making nested array types easier to inspect and consume.

## Definition

```ts
T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]> } : Simplify<T>
```

## Diagram

```mermaid
graph LR
  Input[Input type] --> Check{Is an array?}
  Check -->|Yes| Recurse[Apply SimplifyDeepArray to element type]
  Recurse --> Array[Return array of simplified elements]
  Check -->|No| Simplify[Apply Simplify]
```

## Usage

```ts
type ApiRecord = {
  id: string;
  metadata: {
    createdBy: string;
  };
};

type NestedRecords = ApiRecord[][];

type SimplifiedRecords = SimplifyDeepArray<NestedRecords>;
// SimplifiedRecords is:
// Array<Array<{
//   id: string;
//   metadata: {
//     createdBy: string;
//   };
// }>>
```

## AI Coding Instructions

- Use `SimplifyDeepArray` when a type may contain nested arrays whose element types need simplification.
- Keep the recursive array check before applying `Simplify` to non-array values.
- Do not replace array element recursion with a shallow `Simplify`, or nested array elements will remain unsimplified.
- Use `SimplifyDeepArray` for type-level readability only; it does not transform runtime values.
