Flatten Array
Flattens a nested array recursively or wraps any non-array data type in an array.
flattenArray
Flattens a nested array recursively or wraps any non-array data type in an array.
Function Signature
function flattenArray<T>(input: T | T[]): Flattened<T>[]Type Parameters
T: The type of the input, which can be a nested array or a non-array value.
Parameters
input(T | T[]): The input value, which can be a nested array or a non-array value.
Returns
Flattened<T>[]: A fully flattened array. If the input is not an array, it wraps it in a single-element array.
Example
playground.ts
Last updated: Sun, Jun 14, 2026 07:06:16AM (UTC)
