Skip to content

Commit 8c2d086

Browse files
committed
bug(esnext) add overloads for flatten
1 parent 8c2eeb2 commit 8c2d086

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

src/lib/esnext.array.d.ts

+65-1
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,75 @@ interface Array<T> {
4141
thisArg?: This
4242
): U[]
4343

44+
/**
45+
* Returns a new array with all sub-array elements concatenated into it recursively up to the
46+
* specified depth.
47+
*
48+
* @param depth The maximum recursion depth
49+
*/
50+
flatten<U>(this: U[][][][][][][][], depth: 7): U[];
51+
52+
/**
53+
* Returns a new array with all sub-array elements concatenated into it recursively up to the
54+
* specified depth.
55+
*
56+
* @param depth The maximum recursion depth
57+
*/
58+
flatten<U>(this: U[][][][][][][], depth: 6): U[];
59+
60+
/**
61+
* Returns a new array with all sub-array elements concatenated into it recursively up to the
62+
* specified depth.
63+
*
64+
* @param depth The maximum recursion depth
65+
*/
66+
flatten<U>(this: U[][][][][][], depth: 5): U[];
67+
68+
/**
69+
* Returns a new array with all sub-array elements concatenated into it recursively up to the
70+
* specified depth.
71+
*
72+
* @param depth The maximum recursion depth
73+
*/
74+
flatten<U>(this: U[][][][][], depth: 4): U[];
75+
76+
/**
77+
* Returns a new array with all sub-array elements concatenated into it recursively up to the
78+
* specified depth.
79+
*
80+
* @param depth The maximum recursion depth
81+
*/
82+
flatten<U>(this: U[][][][], depth: 3): U[];
83+
84+
/**
85+
* Returns a new array with all sub-array elements concatenated into it recursively up to the
86+
* specified depth.
87+
*
88+
* @param depth The maximum recursion depth
89+
*/
90+
flatten<U>(this: U[][][], depth: 2): U[];
91+
92+
/**
93+
* Returns a new array with all sub-array elements concatenated into it recursively up to the
94+
* specified depth.
95+
*
96+
* @param depth The maximum recursion depth
97+
*/
98+
flatten<U>(this: U[][], depth?: 1): U[];
99+
100+
/**
101+
* Returns a new array with all sub-array elements concatenated into it recursively up to the
102+
* specified depth.
103+
*
104+
* @param depth The maximum recursion depth
105+
*/
106+
flatten<U>(this: U[], depth: 0): U[];
107+
44108
/**
45109
* Returns a new array with all sub-array elements concatenated into it recursively up to the
46110
* specified depth. If no depth is provided, flatten method defaults to the depth of 1.
47111
*
48112
* @param depth The maximum recursion depth
49113
*/
50-
flatten<U>(this: U[], depth?: number): U[];
114+
flatten<U>(depth?: number): any[];
51115
}

0 commit comments

Comments
 (0)