You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
526 B

4 years ago
  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;