array-flatten.d.ts 526 B

12345678910111213141516
  1. declare function flatten <T> (array: flatten.NestedArray<T>): T[];
  2. declare namespace flatten {
  3. export interface NestedArray <T> extends ReadonlyArray<T | NestedArray<T>> {}
  4. export interface NestedList <T> {
  5. [index: number]: T | NestedList<T>;
  6. length: number;
  7. }
  8. export function from <T> (array: NestedList<T>): T[];
  9. export function depth <T> (array: NestedArray<T>, depth: number): NestedArray<T>;
  10. export function depthFrom <T> (array: NestedList<T>, depth: number): NestedArray<T>;
  11. }
  12. export = flatten;