|
| 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 | +interface ArrayConstructor { |
| 17 | + isArray(arg: any): arg is any[]; |
| 18 | +} |
| 19 | + |
| 20 | +interface Array<T> { |
| 21 | + /** |
| 22 | + * Determines whether all the members of an array satisfy the specified test. |
| 23 | + * @param callbackfn A function that accepts up to three arguments. The every method calls |
| 24 | + * the callbackfn function for each element in the array until the callbackfn returns a value |
| 25 | + * which is coercible to the Boolean value false, or until the end of the array. |
| 26 | + * @param thisArg An object to which the this keyword can refer in the callbackfn function. |
| 27 | + * If thisArg is omitted, undefined is used as the this value. |
| 28 | + */ |
| 29 | + every(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; |
| 30 | + |
| 31 | + /** |
| 32 | + * Returns the elements of an array that meet the condition specified in a callback function. |
| 33 | + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. |
| 34 | + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. |
| 35 | + */ |
| 36 | + filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; |
| 37 | + |
| 38 | + /** |
| 39 | + * Returns the elements of an array that meet the condition specified in a callback function. |
| 40 | + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. |
| 41 | + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. |
| 42 | + */ |
| 43 | + filter(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; |
| 44 | + |
| 45 | + /** |
| 46 | + * Performs the specified action for each element in an array. |
| 47 | + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. |
| 48 | + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. |
| 49 | + */ |
| 50 | + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; |
| 51 | + |
| 52 | + /** |
| 53 | + * Returns the index of the first occurrence of a value in an array. |
| 54 | + * @param searchElement The value to locate in the array. |
| 55 | + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. |
| 56 | + */ |
| 57 | + indexOf(searchElement: T, fromIndex?: number): number; |
| 58 | + |
| 59 | + /** |
| 60 | + * Returns the index of the last occurrence of a specified value in an array. |
| 61 | + * @param searchElement The value to locate in the array. |
| 62 | + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. |
| 63 | + */ |
| 64 | + lastIndexOf(searchElement: T, fromIndex?: number): number; |
| 65 | + |
| 66 | + /** |
| 67 | + * Calls a defined callback function on each element of an array, and returns an array that contains the results. |
| 68 | + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. |
| 69 | + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. |
| 70 | + */ |
| 71 | + map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; |
| 72 | + |
| 73 | + /** |
| 74 | + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
| 75 | + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. |
| 76 | + */ |
| 77 | + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; |
| 78 | + |
| 79 | + /** |
| 80 | + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
| 81 | + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. |
| 82 | + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. |
| 83 | + */ |
| 84 | + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; |
| 85 | + |
| 86 | + /** |
| 87 | + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
| 88 | + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. |
| 89 | + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. |
| 90 | + */ |
| 91 | + reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; |
| 92 | + |
| 93 | + /** |
| 94 | + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
| 95 | + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. |
| 96 | + */ |
| 97 | + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; |
| 98 | + |
| 99 | + /** |
| 100 | + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
| 101 | + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. |
| 102 | + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. |
| 103 | + */ |
| 104 | + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; |
| 105 | + |
| 106 | + /** |
| 107 | + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
| 108 | + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. |
| 109 | + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. |
| 110 | + */ |
| 111 | + reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; |
| 112 | + |
| 113 | + /** |
| 114 | + * Determines whether the specified callback function returns true for any element of an array. |
| 115 | + * @param callbackfn A function that accepts up to three arguments. The some method calls |
| 116 | + * the callbackfn function for each element in the array until the callbackfn returns a value |
| 117 | + * which is coercible to the Boolean value true, or until the end of the array. |
| 118 | + * @param thisArg An object to which the this keyword can refer in the callbackfn function. |
| 119 | + * If thisArg is omitted, undefined is used as the this value. |
| 120 | + */ |
| 121 | + some(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; |
| 122 | +} |
0 commit comments