Skip to content

Commit cac3a32

Browse files
committed
Add ReadonlyArray<T> to core.d.ts
1 parent 4abf717 commit cac3a32

File tree

1 file changed

+102
-13
lines changed

1 file changed

+102
-13
lines changed

Diff for: src/lib/core.d.ts

+102-13
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,108 @@ declare var JSON: JSON;
988988
/// ECMAScript Array API (specially handled by compiler)
989989
/////////////////////////////
990990

991+
interface ReadonlyArray<T> {
992+
/**
993+
* Gets the length of the array. This is a number one higher than the highest element defined in an array.
994+
*/
995+
readonly length: number;
996+
/**
997+
* Returns a string representation of an array.
998+
*/
999+
toString(): string;
1000+
toLocaleString(): string;
1001+
/**
1002+
* Combines two or more arrays.
1003+
* @param items Additional items to add to the end of array1.
1004+
*/
1005+
concat<U extends ReadonlyArray<T>>(...items: U[]): T[];
1006+
/**
1007+
* Combines two or more arrays.
1008+
* @param items Additional items to add to the end of array1.
1009+
*/
1010+
concat(...items: T[]): T[];
1011+
/**
1012+
* Adds all the elements of an array separated by the specified separator string.
1013+
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
1014+
*/
1015+
join(separator?: string): string;
1016+
/**
1017+
* Returns a section of an array.
1018+
* @param start The beginning of the specified portion of the array.
1019+
* @param end The end of the specified portion of the array.
1020+
*/
1021+
slice(start?: number, end?: number): T[];
1022+
/**
1023+
* Returns the index of the first occurrence of a value in an array.
1024+
* @param searchElement The value to locate in the array.
1025+
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
1026+
*/
1027+
indexOf(searchElement: T, fromIndex?: number): number;
1028+
1029+
/**
1030+
* Returns the index of the last occurrence of a specified value in an array.
1031+
* @param searchElement The value to locate in the array.
1032+
* @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.
1033+
*/
1034+
lastIndexOf(searchElement: T, fromIndex?: number): number;
1035+
/**
1036+
* Determines whether all the members of an array satisfy the specified test.
1037+
* @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
1038+
* @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.
1039+
*/
1040+
every(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => boolean, thisArg?: any): boolean;
1041+
/**
1042+
* Determines whether the specified callback function returns true for any element of an array.
1043+
* @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
1044+
* @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.
1045+
*/
1046+
some(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => boolean, thisArg?: any): boolean;
1047+
/**
1048+
* Performs the specified action for each element in an array.
1049+
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
1050+
* @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.
1051+
*/
1052+
forEach(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => void, thisArg?: any): void;
1053+
/**
1054+
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
1055+
* @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.
1056+
* @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.
1057+
*/
1058+
map<U>(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => U, thisArg?: any): U[];
1059+
/**
1060+
* Returns the elements of an array that meet the condition specified in a callback function.
1061+
* @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.
1062+
* @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.
1063+
*/
1064+
filter(callbackfn: (value: T, index: number, array: ReadonlyArray<T>) => boolean, thisArg?: any): T[];
1065+
/**
1066+
* 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.
1067+
* @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.
1068+
* @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.
1069+
*/
1070+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => T, initialValue?: T): T;
1071+
/**
1072+
* 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.
1073+
* @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.
1074+
* @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.
1075+
*/
1076+
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => U, initialValue: U): U;
1077+
/**
1078+
* 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.
1079+
* @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.
1080+
* @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.
1081+
*/
1082+
reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => T, initialValue?: T): T;
1083+
/**
1084+
* 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.
1085+
* @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.
1086+
* @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.
1087+
*/
1088+
reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray<T>) => U, initialValue: U): U;
1089+
1090+
readonly [n: number]: T;
1091+
}
1092+
9911093
interface Array<T> {
9921094
/**
9931095
* Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
@@ -1036,82 +1138,70 @@ interface Array<T> {
10361138
* @param end The end of the specified portion of the array.
10371139
*/
10381140
slice(start?: number, end?: number): T[];
1039-
10401141
/**
10411142
* Sorts an array.
10421143
* @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
10431144
*/
10441145
sort(compareFn?: (a: T, b: T) => number): T[];
1045-
10461146
/**
10471147
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
10481148
* @param start The zero-based location in the array from which to start removing elements.
10491149
*/
10501150
splice(start: number): T[];
1051-
10521151
/**
10531152
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
10541153
* @param start The zero-based location in the array from which to start removing elements.
10551154
* @param deleteCount The number of elements to remove.
10561155
* @param items Elements to insert into the array in place of the deleted elements.
10571156
*/
10581157
splice(start: number, deleteCount: number, ...items: T[]): T[];
1059-
10601158
/**
10611159
* Inserts new elements at the start of an array.
10621160
* @param items Elements to insert at the start of the Array.
10631161
*/
10641162
unshift(...items: T[]): number;
1065-
10661163
/**
10671164
* Returns the index of the first occurrence of a value in an array.
10681165
* @param searchElement The value to locate in the array.
10691166
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
10701167
*/
10711168
indexOf(searchElement: T, fromIndex?: number): number;
1072-
10731169
/**
10741170
* Returns the index of the last occurrence of a specified value in an array.
10751171
* @param searchElement The value to locate in the array.
10761172
* @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.
10771173
*/
10781174
lastIndexOf(searchElement: T, fromIndex?: number): number;
1079-
10801175
/**
10811176
* Determines whether all the members of an array satisfy the specified test.
10821177
* @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
10831178
* @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.
10841179
*/
10851180
every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
1086-
10871181
/**
10881182
* Determines whether the specified callback function returns true for any element of an array.
10891183
* @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
10901184
* @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.
10911185
*/
10921186
some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
1093-
10941187
/**
10951188
* Performs the specified action for each element in an array.
10961189
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
10971190
* @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.
10981191
*/
10991192
forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
1100-
11011193
/**
11021194
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
11031195
* @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.
11041196
* @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.
11051197
*/
11061198
map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
1107-
11081199
/**
11091200
* Returns the elements of an array that meet the condition specified in a callback function.
11101201
* @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.
11111202
* @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.
11121203
*/
11131204
filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
1114-
11151205
/**
11161206
* 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.
11171207
* @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.
@@ -1124,7 +1214,6 @@ interface Array<T> {
11241214
* @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.
11251215
*/
11261216
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
1127-
11281217
/**
11291218
* 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.
11301219
* @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.

0 commit comments

Comments
 (0)