SDK
API Documentation
core
type-aliases
Flatten

Type Alias: Flatten<A>

Flatten<A>: A extends readonly infer I[] ? I : never

The Flatten type takes an array type and returns the type of the elements in the array. It uses conditional types and type inference to achieve this. If A is an array of some type I, it returns I. If A is not an array, it returns never.

Type Parameters

Type Parameter
A extends readonly unknown[]

Defined in

lib/types.ts:181 (opens in a new tab)