Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / prettier-eslint / node_modules / typescript / lib / lib.es2019.array.d.ts
1 /*! *****************************************************************************
2 Copyright (c) Microsoft Corporation. All rights reserved.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the
5 License at http://www.apache.org/licenses/LICENSE-2.0
6
7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 MERCHANTABLITY OR NON-INFRINGEMENT.
11
12 See the Apache Version 2.0 License for specific language governing permissions
13 and limitations under the License.
14 ***************************************************************************** */
15
16
17
18 /// <reference no-default-lib="true"/>\r
19
20
21 type FlatArray<Arr, Depth extends number> = {\r
22     "done": Arr,\r
23     "recur": Arr extends ReadonlyArray<infer InnerArr>\r
24         ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>\r
25         : Arr\r
26 }[Depth extends -1 ? "done" : "recur"];\r
27 \r
28 interface ReadonlyArray<T> {\r
29 \r
30     /**\r
31      * Calls a defined callback function on each element of an array. Then, flattens the result into\r
32      * a new array.\r
33      * This is identical to a map followed by flat with depth 1.\r
34      *\r
35      * @param callback A function that accepts up to three arguments. The flatMap method calls the\r
36      * callback function one time for each element in the array.\r
37      * @param thisArg An object to which the this keyword can refer in the callback function. If\r
38      * thisArg is omitted, undefined is used as the this value.\r
39      */\r
40     flatMap<U, This = undefined> (\r
41         callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,\r
42         thisArg?: This\r
43     ): U[]\r
44 \r
45 \r
46     /**\r
47      * Returns a new array with all sub-array elements concatenated into it recursively up to the\r
48      * specified depth.\r
49      *\r
50      * @param depth The maximum recursion depth\r
51      */\r
52     flat<A, D extends number = 1>(\r
53         this: A,\r
54         depth?: D\r
55     ): FlatArray<A, D>[]\r
56   }\r
57 \r
58 interface Array<T> {\r
59 \r
60     /**\r
61      * Calls a defined callback function on each element of an array. Then, flattens the result into\r
62      * a new array.\r
63      * This is identical to a map followed by flat with depth 1.\r
64      *\r
65      * @param callback A function that accepts up to three arguments. The flatMap method calls the\r
66      * callback function one time for each element in the array.\r
67      * @param thisArg An object to which the this keyword can refer in the callback function. If\r
68      * thisArg is omitted, undefined is used as the this value.\r
69      */\r
70     flatMap<U, This = undefined> (\r
71         callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,\r
72         thisArg?: This\r
73     ): U[]\r
74 \r
75     /**\r
76      * Returns a new array with all sub-array elements concatenated into it recursively up to the\r
77      * specified depth.\r
78      *\r
79      * @param depth The maximum recursion depth\r
80      */\r
81     flat<A, D extends number = 1>(\r
82         this: A,\r
83         depth?: D\r
84     ): FlatArray<A, D>[]\r
85 }\r