#1075·type-fest

Proposal: `Flat` (equivalent to `Array.prototype.flat()`)

Author: gustavopchCreated Mar 4, 2025Updated Jul 13, 2026
Labelstype addition

Type description + examples

I'd like to propose something like Array.prototype.flat() but for types.

Type source

typescript
type Flat<T extends any[][]> = T extends (infer U)[][] ? U : never;

type Input = [
  ['A', 'B'],
  ['C'],
]

type Output = Flat<Input>
// => ['A', 'B', 'C']

Search existing types and issues first

  • I tried my best to look for it