Skip to content

Rename ESNext flatten to flat #24527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/lib/esnext.array.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ interface ReadonlyArray<T> {
/**
* Calls a defined callback function on each element of an array. Then, flattens the result into
* a new array.
* This is identical to a map followed by a flatten of depth 1.
* This is identical to a map followed by flat with depth 1.
*
* @param callback A function that accepts up to three arguments. The flatMap method calls the
* callback function one time for each element in the array.
Expand All @@ -22,7 +22,7 @@ interface ReadonlyArray<T> {
*
* @param depth The maximum recursion depth
*/
flatten<U>(this:
flat<U>(this:
ReadonlyArray<U[][][][]> |

ReadonlyArray<ReadonlyArray<U[][][]>> |
Expand Down Expand Up @@ -51,7 +51,7 @@ interface ReadonlyArray<T> {
*
* @param depth The maximum recursion depth
*/
flatten<U>(this:
flat<U>(this:
ReadonlyArray<U[][][]> |

ReadonlyArray<ReadonlyArray<U>[][]> |
Expand All @@ -71,7 +71,7 @@ interface ReadonlyArray<T> {
*
* @param depth The maximum recursion depth
*/
flatten<U>(this:
flat<U>(this:
ReadonlyArray<U[][]> |

ReadonlyArray<ReadonlyArray<U[]>> |
Expand All @@ -86,7 +86,7 @@ interface ReadonlyArray<T> {
*
* @param depth The maximum recursion depth
*/
flatten<U>(this:
flat<U>(this:
ReadonlyArray<U[]> |
ReadonlyArray<ReadonlyArray<U>>,
depth?: 1
Expand All @@ -98,26 +98,26 @@ interface ReadonlyArray<T> {
*
* @param depth The maximum recursion depth
*/
flatten<U>(this:
flat<U>(this:
ReadonlyArray<U>,
depth: 0
): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth. If no depth is provided, flatten method defaults to the depth of 1.
* specified depth. If no depth is provided, flat method defaults to the depth of 1.
*
* @param depth The maximum recursion depth
*/
flatten<U>(depth?: number): any[];
flat<U>(depth?: number): any[];
}

interface Array<T> {

/**
* Calls a defined callback function on each element of an array. Then, flattens the result into
* a new array.
* This is identical to a map followed by a flatten of depth 1.
* This is identical to a map followed by flat with depth 1.
*
* @param callback A function that accepts up to three arguments. The flatMap method calls the
* callback function one time for each element in the array.
Expand All @@ -135,69 +135,69 @@ interface Array<T> {
*
* @param depth The maximum recursion depth
*/
flatten<U>(this: U[][][][][][][][], depth: 7): U[];
flat<U>(this: U[][][][][][][][], depth: 7): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flatten<U>(this: U[][][][][][][], depth: 6): U[];
flat<U>(this: U[][][][][][][], depth: 6): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flatten<U>(this: U[][][][][][], depth: 5): U[];
flat<U>(this: U[][][][][][], depth: 5): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flatten<U>(this: U[][][][][], depth: 4): U[];
flat<U>(this: U[][][][][], depth: 4): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flatten<U>(this: U[][][][], depth: 3): U[];
flat<U>(this: U[][][][], depth: 3): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flatten<U>(this: U[][][], depth: 2): U[];
flat<U>(this: U[][][], depth: 2): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flatten<U>(this: U[][], depth?: 1): U[];
flat<U>(this: U[][], depth?: 1): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flatten<U>(this: U[], depth: 0): U[];
flat<U>(this: U[], depth: 0): U[];

/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth. If no depth is provided, flatten method defaults to the depth of 1.
* specified depth. If no depth is provided, flat method defaults to the depth of 1.
*
* @param depth The maximum recursion depth
*/
flatten<U>(depth?: number): any[];
flat<U>(depth?: number): any[];
}