@bedrock-apis/env-types 1.0.0-beta → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib.d.ts +903 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Install the package as a development dependency, and add it to the known types i
|
|
|
36
36
|
This package is in **beta**, and we welcome contributions from the community. You can help by:
|
|
37
37
|
|
|
38
38
|
* Adding missing type definitions.
|
|
39
|
-
* Fixing inconsistencies between types and engine environment.
|
|
39
|
+
* Fixing inconsistencies between types and engine environment apis.
|
|
40
40
|
* Suggesting new features or improvements.
|
|
41
41
|
|
|
42
42
|
Please visit our [GitHub repository](https://github.com/bedrock-apis/env-types) to submit issues or pull requests.
|
package/lib.d.ts
CHANGED
|
@@ -2947,6 +2947,909 @@ interface String {
|
|
|
2947
2947
|
replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
|
|
2948
2948
|
}
|
|
2949
2949
|
|
|
2950
|
+
interface Array<T> {
|
|
2951
|
+
/**
|
|
2952
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
2953
|
+
* otherwise.
|
|
2954
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
2955
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
2956
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
2957
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
2958
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
2959
|
+
*/
|
|
2960
|
+
findLast<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S | undefined;
|
|
2961
|
+
findLast(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T | undefined;
|
|
2962
|
+
/**
|
|
2963
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
2964
|
+
* otherwise.
|
|
2965
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
2966
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
2967
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
2968
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
2969
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
2970
|
+
*/
|
|
2971
|
+
findLastIndex(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): number;
|
|
2972
|
+
/**
|
|
2973
|
+
* Returns a copy of an array with its elements reversed.
|
|
2974
|
+
*/
|
|
2975
|
+
toReversed(): T[];
|
|
2976
|
+
/**
|
|
2977
|
+
* Returns a copy of an array with its elements sorted.
|
|
2978
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
2979
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
2980
|
+
* value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
|
|
2981
|
+
* ```ts
|
|
2982
|
+
* [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
|
|
2983
|
+
* ```
|
|
2984
|
+
*/
|
|
2985
|
+
toSorted(compareFn?: (a: T, b: T) => number): T[];
|
|
2986
|
+
/**
|
|
2987
|
+
* Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.
|
|
2988
|
+
* @param start The zero-based location in the array from which to start removing elements.
|
|
2989
|
+
* @param deleteCount The number of elements to remove.
|
|
2990
|
+
* @param items Elements to insert into the copied array in place of the deleted elements.
|
|
2991
|
+
* @returns The copied array.
|
|
2992
|
+
*/
|
|
2993
|
+
toSpliced(start: number, deleteCount: number, ...items: T[]): T[];
|
|
2994
|
+
/**
|
|
2995
|
+
* Copies an array and removes elements while returning the remaining elements.
|
|
2996
|
+
* @param start The zero-based location in the array from which to start removing elements.
|
|
2997
|
+
* @param deleteCount The number of elements to remove.
|
|
2998
|
+
* @returns A copy of the original array with the remaining elements.
|
|
2999
|
+
*/
|
|
3000
|
+
toSpliced(start: number, deleteCount?: number): T[];
|
|
3001
|
+
/**
|
|
3002
|
+
* Copies an array, then overwrites the value at the provided index with the
|
|
3003
|
+
* given value. If the index is negative, then it replaces from the end
|
|
3004
|
+
* of the array.
|
|
3005
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3006
|
+
* negative, then it replaces from the end of the array.
|
|
3007
|
+
* @param value The value to write into the copied array.
|
|
3008
|
+
* @returns The copied array with the updated value.
|
|
3009
|
+
*/
|
|
3010
|
+
with(index: number, value: T): T[];
|
|
3011
|
+
}
|
|
3012
|
+
interface ReadonlyArray<T> {
|
|
3013
|
+
/**
|
|
3014
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3015
|
+
* otherwise.
|
|
3016
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3017
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3018
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3019
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3020
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3021
|
+
*/
|
|
3022
|
+
findLast<S extends T>(
|
|
3023
|
+
predicate: (value: T, index: number, array: readonly T[]) => value is S,
|
|
3024
|
+
thisArg?: any,
|
|
3025
|
+
): S | undefined;
|
|
3026
|
+
findLast(
|
|
3027
|
+
predicate: (value: T, index: number, array: readonly T[]) => unknown,
|
|
3028
|
+
thisArg?: any,
|
|
3029
|
+
): T | undefined;
|
|
3030
|
+
/**
|
|
3031
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3032
|
+
* otherwise.
|
|
3033
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3034
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3035
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3036
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3037
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3038
|
+
*/
|
|
3039
|
+
findLastIndex(
|
|
3040
|
+
predicate: (value: T, index: number, array: readonly T[]) => unknown,
|
|
3041
|
+
thisArg?: any,
|
|
3042
|
+
): number;
|
|
3043
|
+
/**
|
|
3044
|
+
* Copies the array and returns the copied array with all of its elements reversed.
|
|
3045
|
+
*/
|
|
3046
|
+
toReversed(): T[];
|
|
3047
|
+
/**
|
|
3048
|
+
* Copies and sorts the array.
|
|
3049
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3050
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3051
|
+
* value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
|
|
3052
|
+
* ```ts
|
|
3053
|
+
* [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
|
|
3054
|
+
* ```
|
|
3055
|
+
*/
|
|
3056
|
+
toSorted(compareFn?: (a: T, b: T) => number): T[];
|
|
3057
|
+
/**
|
|
3058
|
+
* Copies an array and removes elements while, if necessary, inserting new elements in their place, returning the remaining elements.
|
|
3059
|
+
* @param start The zero-based location in the array from which to start removing elements.
|
|
3060
|
+
* @param deleteCount The number of elements to remove.
|
|
3061
|
+
* @param items Elements to insert into the copied array in place of the deleted elements.
|
|
3062
|
+
* @returns A copy of the original array with the remaining elements.
|
|
3063
|
+
*/
|
|
3064
|
+
toSpliced(start: number, deleteCount: number, ...items: T[]): T[];
|
|
3065
|
+
/**
|
|
3066
|
+
* Copies an array and removes elements while returning the remaining elements.
|
|
3067
|
+
* @param start The zero-based location in the array from which to start removing elements.
|
|
3068
|
+
* @param deleteCount The number of elements to remove.
|
|
3069
|
+
* @returns A copy of the original array with the remaining elements.
|
|
3070
|
+
*/
|
|
3071
|
+
toSpliced(start: number, deleteCount?: number): T[];
|
|
3072
|
+
/**
|
|
3073
|
+
* Copies an array, then overwrites the value at the provided index with the
|
|
3074
|
+
* given value. If the index is negative, then it replaces from the end
|
|
3075
|
+
* of the array
|
|
3076
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3077
|
+
* negative, then it replaces from the end of the array.
|
|
3078
|
+
* @param value The value to insert into the copied array.
|
|
3079
|
+
* @returns A copy of the original array with the inserted value.
|
|
3080
|
+
*/
|
|
3081
|
+
with(index: number, value: T): T[];
|
|
3082
|
+
}
|
|
3083
|
+
interface Int8Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3084
|
+
/**
|
|
3085
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3086
|
+
* otherwise.
|
|
3087
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3088
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3089
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3090
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3091
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3092
|
+
*/
|
|
3093
|
+
findLast<S extends number>(
|
|
3094
|
+
predicate: (
|
|
3095
|
+
value: number,
|
|
3096
|
+
index: number,
|
|
3097
|
+
array: this,
|
|
3098
|
+
) => value is S,
|
|
3099
|
+
thisArg?: any,
|
|
3100
|
+
): S | undefined;
|
|
3101
|
+
findLast(
|
|
3102
|
+
predicate: (value: number, index: number, array: this) => unknown,
|
|
3103
|
+
thisArg?: any,
|
|
3104
|
+
): number | undefined;
|
|
3105
|
+
/**
|
|
3106
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3107
|
+
* otherwise.
|
|
3108
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3109
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3110
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3111
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3112
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3113
|
+
*/
|
|
3114
|
+
findLastIndex(
|
|
3115
|
+
predicate: (value: number, index: number, array: this) => unknown,
|
|
3116
|
+
thisArg?: any,
|
|
3117
|
+
): number;
|
|
3118
|
+
/**
|
|
3119
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3120
|
+
*/
|
|
3121
|
+
toReversed(): Int8Array<ArrayBuffer>;
|
|
3122
|
+
/**
|
|
3123
|
+
* Copies and sorts the array.
|
|
3124
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3125
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3126
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3127
|
+
* ```ts
|
|
3128
|
+
* const myNums = Int8Array.from([11, 2, 22, 1]);
|
|
3129
|
+
* myNums.toSorted((a, b) => a - b) // Int8Array(4) [1, 2, 11, 22]
|
|
3130
|
+
* ```
|
|
3131
|
+
*/
|
|
3132
|
+
toSorted(compareFn?: (a: number, b: number) => number): Int8Array<ArrayBuffer>;
|
|
3133
|
+
/**
|
|
3134
|
+
* Copies the array and inserts the given number at the provided index.
|
|
3135
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3136
|
+
* negative, then it replaces from the end of the array.
|
|
3137
|
+
* @param value The value to insert into the copied array.
|
|
3138
|
+
* @returns A copy of the original array with the inserted value.
|
|
3139
|
+
*/
|
|
3140
|
+
with(index: number, value: number): Int8Array<ArrayBuffer>;
|
|
3141
|
+
}
|
|
3142
|
+
interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3143
|
+
/**
|
|
3144
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3145
|
+
* otherwise.
|
|
3146
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3147
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3148
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3149
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3150
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3151
|
+
*/
|
|
3152
|
+
findLast<S extends number>(
|
|
3153
|
+
predicate: (
|
|
3154
|
+
value: number,
|
|
3155
|
+
index: number,
|
|
3156
|
+
array: this,
|
|
3157
|
+
) => value is S,
|
|
3158
|
+
thisArg?: any,
|
|
3159
|
+
): S | undefined;
|
|
3160
|
+
findLast(
|
|
3161
|
+
predicate: (value: number, index: number, array: this) => unknown,
|
|
3162
|
+
thisArg?: any,
|
|
3163
|
+
): number | undefined;
|
|
3164
|
+
/**
|
|
3165
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3166
|
+
* otherwise.
|
|
3167
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3168
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3169
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3170
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3171
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3172
|
+
*/
|
|
3173
|
+
findLastIndex(
|
|
3174
|
+
predicate: (value: number, index: number, array: this) => unknown,
|
|
3175
|
+
thisArg?: any,
|
|
3176
|
+
): number;
|
|
3177
|
+
/**
|
|
3178
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3179
|
+
*/
|
|
3180
|
+
toReversed(): Uint8Array<ArrayBuffer>;
|
|
3181
|
+
/**
|
|
3182
|
+
* Copies and sorts the array.
|
|
3183
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3184
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3185
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3186
|
+
* ```ts
|
|
3187
|
+
* const myNums = Uint8Array.from([11, 2, 22, 1]);
|
|
3188
|
+
* myNums.toSorted((a, b) => a - b) // Uint8Array(4) [1, 2, 11, 22]
|
|
3189
|
+
* ```
|
|
3190
|
+
*/
|
|
3191
|
+
toSorted(compareFn?: (a: number, b: number) => number): Uint8Array<ArrayBuffer>;
|
|
3192
|
+
/**
|
|
3193
|
+
* Copies the array and inserts the given number at the provided index.
|
|
3194
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3195
|
+
* negative, then it replaces from the end of the array.
|
|
3196
|
+
* @param value The value to insert into the copied array.
|
|
3197
|
+
* @returns A copy of the original array with the inserted value.
|
|
3198
|
+
*/
|
|
3199
|
+
with(index: number, value: number): Uint8Array<ArrayBuffer>;
|
|
3200
|
+
}
|
|
3201
|
+
interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {
|
|
3202
|
+
/**
|
|
3203
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3204
|
+
* otherwise.
|
|
3205
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3206
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3207
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3208
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3209
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3210
|
+
*/
|
|
3211
|
+
findLast<S extends number>(
|
|
3212
|
+
predicate: (
|
|
3213
|
+
value: number,
|
|
3214
|
+
index: number,
|
|
3215
|
+
array: this,
|
|
3216
|
+
) => value is S,
|
|
3217
|
+
thisArg?: any,
|
|
3218
|
+
): S | undefined;
|
|
3219
|
+
findLast(
|
|
3220
|
+
predicate: (
|
|
3221
|
+
value: number,
|
|
3222
|
+
index: number,
|
|
3223
|
+
array: this,
|
|
3224
|
+
) => unknown,
|
|
3225
|
+
thisArg?: any,
|
|
3226
|
+
): number | undefined;
|
|
3227
|
+
/**
|
|
3228
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3229
|
+
* otherwise.
|
|
3230
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3231
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3232
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3233
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3234
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3235
|
+
*/
|
|
3236
|
+
findLastIndex(
|
|
3237
|
+
predicate: (
|
|
3238
|
+
value: number,
|
|
3239
|
+
index: number,
|
|
3240
|
+
array: this,
|
|
3241
|
+
) => unknown,
|
|
3242
|
+
thisArg?: any,
|
|
3243
|
+
): number;
|
|
3244
|
+
/**
|
|
3245
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3246
|
+
*/
|
|
3247
|
+
toReversed(): Uint8ClampedArray<ArrayBuffer>;
|
|
3248
|
+
/**
|
|
3249
|
+
* Copies and sorts the array.
|
|
3250
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3251
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3252
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3253
|
+
* ```ts
|
|
3254
|
+
* const myNums = Uint8ClampedArray.from([11, 2, 22, 1]);
|
|
3255
|
+
* myNums.toSorted((a, b) => a - b) // Uint8ClampedArray(4) [1, 2, 11, 22]
|
|
3256
|
+
* ```
|
|
3257
|
+
*/
|
|
3258
|
+
toSorted(compareFn?: (a: number, b: number) => number): Uint8ClampedArray<ArrayBuffer>;
|
|
3259
|
+
/**
|
|
3260
|
+
* Copies the array and inserts the given number at the provided index.
|
|
3261
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3262
|
+
* negative, then it replaces from the end of the array.
|
|
3263
|
+
* @param value The value to insert into the copied array.
|
|
3264
|
+
* @returns A copy of the original array with the inserted value.
|
|
3265
|
+
*/
|
|
3266
|
+
with(index: number, value: number): Uint8ClampedArray<ArrayBuffer>;
|
|
3267
|
+
}
|
|
3268
|
+
interface Int16Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3269
|
+
/**
|
|
3270
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3271
|
+
* otherwise.
|
|
3272
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3273
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3274
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3275
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3276
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3277
|
+
*/
|
|
3278
|
+
findLast<S extends number>(
|
|
3279
|
+
predicate: (
|
|
3280
|
+
value: number,
|
|
3281
|
+
index: number,
|
|
3282
|
+
array: this,
|
|
3283
|
+
) => value is S,
|
|
3284
|
+
thisArg?: any,
|
|
3285
|
+
): S | undefined;
|
|
3286
|
+
findLast(
|
|
3287
|
+
predicate: (value: number, index: number, array: this) => unknown,
|
|
3288
|
+
thisArg?: any,
|
|
3289
|
+
): number | undefined;
|
|
3290
|
+
/**
|
|
3291
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3292
|
+
* otherwise.
|
|
3293
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3294
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3295
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3296
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3297
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3298
|
+
*/
|
|
3299
|
+
findLastIndex(
|
|
3300
|
+
predicate: (value: number, index: number, array: this) => unknown,
|
|
3301
|
+
thisArg?: any,
|
|
3302
|
+
): number;
|
|
3303
|
+
/**
|
|
3304
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3305
|
+
*/
|
|
3306
|
+
toReversed(): Int16Array<ArrayBuffer>;
|
|
3307
|
+
/**
|
|
3308
|
+
* Copies and sorts the array.
|
|
3309
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3310
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3311
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3312
|
+
* ```ts
|
|
3313
|
+
* const myNums = Int16Array.from([11, 2, -22, 1]);
|
|
3314
|
+
* myNums.toSorted((a, b) => a - b) // Int16Array(4) [-22, 1, 2, 11]
|
|
3315
|
+
* ```
|
|
3316
|
+
*/
|
|
3317
|
+
toSorted(compareFn?: (a: number, b: number) => number): Int16Array<ArrayBuffer>;
|
|
3318
|
+
/**
|
|
3319
|
+
* Copies the array and inserts the given number at the provided index.
|
|
3320
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3321
|
+
* negative, then it replaces from the end of the array.
|
|
3322
|
+
* @param value The value to insert into the copied array.
|
|
3323
|
+
* @returns A copy of the original array with the inserted value.
|
|
3324
|
+
*/
|
|
3325
|
+
with(index: number, value: number): Int16Array<ArrayBuffer>;
|
|
3326
|
+
}
|
|
3327
|
+
interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3328
|
+
/**
|
|
3329
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3330
|
+
* otherwise.
|
|
3331
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3332
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3333
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3334
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3335
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3336
|
+
*/
|
|
3337
|
+
findLast<S extends number>(
|
|
3338
|
+
predicate: (
|
|
3339
|
+
value: number,
|
|
3340
|
+
index: number,
|
|
3341
|
+
array: this,
|
|
3342
|
+
) => value is S,
|
|
3343
|
+
thisArg?: any,
|
|
3344
|
+
): S | undefined;
|
|
3345
|
+
findLast(
|
|
3346
|
+
predicate: (
|
|
3347
|
+
value: number,
|
|
3348
|
+
index: number,
|
|
3349
|
+
array: this,
|
|
3350
|
+
) => unknown,
|
|
3351
|
+
thisArg?: any,
|
|
3352
|
+
): number | undefined;
|
|
3353
|
+
/**
|
|
3354
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3355
|
+
* otherwise.
|
|
3356
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3357
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3358
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3359
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3360
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3361
|
+
*/
|
|
3362
|
+
findLastIndex(
|
|
3363
|
+
predicate: (
|
|
3364
|
+
value: number,
|
|
3365
|
+
index: number,
|
|
3366
|
+
array: this,
|
|
3367
|
+
) => unknown,
|
|
3368
|
+
thisArg?: any,
|
|
3369
|
+
): number;
|
|
3370
|
+
/**
|
|
3371
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3372
|
+
*/
|
|
3373
|
+
toReversed(): Uint16Array<ArrayBuffer>;
|
|
3374
|
+
/**
|
|
3375
|
+
* Copies and sorts the array.
|
|
3376
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3377
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3378
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3379
|
+
* ```ts
|
|
3380
|
+
* const myNums = Uint16Array.from([11, 2, 22, 1]);
|
|
3381
|
+
* myNums.toSorted((a, b) => a - b) // Uint16Array(4) [1, 2, 11, 22]
|
|
3382
|
+
* ```
|
|
3383
|
+
*/
|
|
3384
|
+
toSorted(compareFn?: (a: number, b: number) => number): Uint16Array<ArrayBuffer>;
|
|
3385
|
+
/**
|
|
3386
|
+
* Copies the array and inserts the given number at the provided index.
|
|
3387
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3388
|
+
* negative, then it replaces from the end of the array.
|
|
3389
|
+
* @param value The value to insert into the copied array.
|
|
3390
|
+
* @returns A copy of the original array with the inserted value.
|
|
3391
|
+
*/
|
|
3392
|
+
with(index: number, value: number): Uint16Array<ArrayBuffer>;
|
|
3393
|
+
}
|
|
3394
|
+
interface Int32Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3395
|
+
/**
|
|
3396
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3397
|
+
* otherwise.
|
|
3398
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3399
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3400
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3401
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3402
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3403
|
+
*/
|
|
3404
|
+
findLast<S extends number>(
|
|
3405
|
+
predicate: (
|
|
3406
|
+
value: number,
|
|
3407
|
+
index: number,
|
|
3408
|
+
array: this,
|
|
3409
|
+
) => value is S,
|
|
3410
|
+
thisArg?: any,
|
|
3411
|
+
): S | undefined;
|
|
3412
|
+
findLast(
|
|
3413
|
+
predicate: (value: number, index: number, array: this) => unknown,
|
|
3414
|
+
thisArg?: any,
|
|
3415
|
+
): number | undefined;
|
|
3416
|
+
/**
|
|
3417
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3418
|
+
* otherwise.
|
|
3419
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3420
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3421
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3422
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3423
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3424
|
+
*/
|
|
3425
|
+
findLastIndex(
|
|
3426
|
+
predicate: (value: number, index: number, array: this) => unknown,
|
|
3427
|
+
thisArg?: any,
|
|
3428
|
+
): number;
|
|
3429
|
+
/**
|
|
3430
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3431
|
+
*/
|
|
3432
|
+
toReversed(): Int32Array<ArrayBuffer>;
|
|
3433
|
+
/**
|
|
3434
|
+
* Copies and sorts the array.
|
|
3435
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3436
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3437
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3438
|
+
* ```ts
|
|
3439
|
+
* const myNums = Int32Array.from([11, 2, -22, 1]);
|
|
3440
|
+
* myNums.toSorted((a, b) => a - b) // Int32Array(4) [-22, 1, 2, 11]
|
|
3441
|
+
* ```
|
|
3442
|
+
*/
|
|
3443
|
+
toSorted(compareFn?: (a: number, b: number) => number): Int32Array<ArrayBuffer>;
|
|
3444
|
+
/**
|
|
3445
|
+
* Copies the array and inserts the given number at the provided index.
|
|
3446
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3447
|
+
* negative, then it replaces from the end of the array.
|
|
3448
|
+
* @param value The value to insert into the copied array.
|
|
3449
|
+
* @returns A copy of the original array with the inserted value.
|
|
3450
|
+
*/
|
|
3451
|
+
with(index: number, value: number): Int32Array<ArrayBuffer>;
|
|
3452
|
+
}
|
|
3453
|
+
interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3454
|
+
/**
|
|
3455
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3456
|
+
* otherwise.
|
|
3457
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3458
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3459
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3460
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3461
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3462
|
+
*/
|
|
3463
|
+
findLast<S extends number>(
|
|
3464
|
+
predicate: (
|
|
3465
|
+
value: number,
|
|
3466
|
+
index: number,
|
|
3467
|
+
array: this,
|
|
3468
|
+
) => value is S,
|
|
3469
|
+
thisArg?: any,
|
|
3470
|
+
): S | undefined;
|
|
3471
|
+
findLast(
|
|
3472
|
+
predicate: (
|
|
3473
|
+
value: number,
|
|
3474
|
+
index: number,
|
|
3475
|
+
array: this,
|
|
3476
|
+
) => unknown,
|
|
3477
|
+
thisArg?: any,
|
|
3478
|
+
): number | undefined;
|
|
3479
|
+
/**
|
|
3480
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3481
|
+
* otherwise.
|
|
3482
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3483
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3484
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3485
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3486
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3487
|
+
*/
|
|
3488
|
+
findLastIndex(
|
|
3489
|
+
predicate: (
|
|
3490
|
+
value: number,
|
|
3491
|
+
index: number,
|
|
3492
|
+
array: this,
|
|
3493
|
+
) => unknown,
|
|
3494
|
+
thisArg?: any,
|
|
3495
|
+
): number;
|
|
3496
|
+
/**
|
|
3497
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3498
|
+
*/
|
|
3499
|
+
toReversed(): Uint32Array<ArrayBuffer>;
|
|
3500
|
+
/**
|
|
3501
|
+
* Copies and sorts the array.
|
|
3502
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3503
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3504
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3505
|
+
* ```ts
|
|
3506
|
+
* const myNums = Uint32Array.from([11, 2, 22, 1]);
|
|
3507
|
+
* myNums.toSorted((a, b) => a - b) // Uint32Array(4) [1, 2, 11, 22]
|
|
3508
|
+
* ```
|
|
3509
|
+
*/
|
|
3510
|
+
toSorted(compareFn?: (a: number, b: number) => number): Uint32Array<ArrayBuffer>;
|
|
3511
|
+
/**
|
|
3512
|
+
* Copies the array and inserts the given number at the provided index.
|
|
3513
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3514
|
+
* negative, then it replaces from the end of the array.
|
|
3515
|
+
* @param value The value to insert into the copied array.
|
|
3516
|
+
* @returns A copy of the original array with the inserted value.
|
|
3517
|
+
*/
|
|
3518
|
+
with(index: number, value: number): Uint32Array<ArrayBuffer>;
|
|
3519
|
+
}
|
|
3520
|
+
interface Float32Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3521
|
+
/**
|
|
3522
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3523
|
+
* otherwise.
|
|
3524
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3525
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3526
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3527
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3528
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3529
|
+
*/
|
|
3530
|
+
findLast<S extends number>(
|
|
3531
|
+
predicate: (
|
|
3532
|
+
value: number,
|
|
3533
|
+
index: number,
|
|
3534
|
+
array: this,
|
|
3535
|
+
) => value is S,
|
|
3536
|
+
thisArg?: any,
|
|
3537
|
+
): S | undefined;
|
|
3538
|
+
findLast(
|
|
3539
|
+
predicate: (
|
|
3540
|
+
value: number,
|
|
3541
|
+
index: number,
|
|
3542
|
+
array: this,
|
|
3543
|
+
) => unknown,
|
|
3544
|
+
thisArg?: any,
|
|
3545
|
+
): number | undefined;
|
|
3546
|
+
/**
|
|
3547
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3548
|
+
* otherwise.
|
|
3549
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3550
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3551
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3552
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3553
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3554
|
+
*/
|
|
3555
|
+
findLastIndex(
|
|
3556
|
+
predicate: (
|
|
3557
|
+
value: number,
|
|
3558
|
+
index: number,
|
|
3559
|
+
array: this,
|
|
3560
|
+
) => unknown,
|
|
3561
|
+
thisArg?: any,
|
|
3562
|
+
): number;
|
|
3563
|
+
/**
|
|
3564
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3565
|
+
*/
|
|
3566
|
+
toReversed(): Float32Array<ArrayBuffer>;
|
|
3567
|
+
/**
|
|
3568
|
+
* Copies and sorts the array.
|
|
3569
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3570
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3571
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3572
|
+
* ```ts
|
|
3573
|
+
* const myNums = Float32Array.from([11.25, 2, -22.5, 1]);
|
|
3574
|
+
* myNums.toSorted((a, b) => a - b) // Float32Array(4) [-22.5, 1, 2, 11.5]
|
|
3575
|
+
* ```
|
|
3576
|
+
*/
|
|
3577
|
+
toSorted(compareFn?: (a: number, b: number) => number): Float32Array<ArrayBuffer>;
|
|
3578
|
+
/**
|
|
3579
|
+
* Copies the array and inserts the given number at the provided index.
|
|
3580
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3581
|
+
* negative, then it replaces from the end of the array.
|
|
3582
|
+
* @param value The value to insert into the copied array.
|
|
3583
|
+
* @returns A copy of the original array with the inserted value.
|
|
3584
|
+
*/
|
|
3585
|
+
with(index: number, value: number): Float32Array<ArrayBuffer>;
|
|
3586
|
+
}
|
|
3587
|
+
interface Float64Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3588
|
+
/**
|
|
3589
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3590
|
+
* otherwise.
|
|
3591
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3592
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3593
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3594
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3595
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3596
|
+
*/
|
|
3597
|
+
findLast<S extends number>(
|
|
3598
|
+
predicate: (
|
|
3599
|
+
value: number,
|
|
3600
|
+
index: number,
|
|
3601
|
+
array: this,
|
|
3602
|
+
) => value is S,
|
|
3603
|
+
thisArg?: any,
|
|
3604
|
+
): S | undefined;
|
|
3605
|
+
findLast(
|
|
3606
|
+
predicate: (
|
|
3607
|
+
value: number,
|
|
3608
|
+
index: number,
|
|
3609
|
+
array: this,
|
|
3610
|
+
) => unknown,
|
|
3611
|
+
thisArg?: any,
|
|
3612
|
+
): number | undefined;
|
|
3613
|
+
/**
|
|
3614
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3615
|
+
* otherwise.
|
|
3616
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3617
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3618
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3619
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3620
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3621
|
+
*/
|
|
3622
|
+
findLastIndex(
|
|
3623
|
+
predicate: (
|
|
3624
|
+
value: number,
|
|
3625
|
+
index: number,
|
|
3626
|
+
array: this,
|
|
3627
|
+
) => unknown,
|
|
3628
|
+
thisArg?: any,
|
|
3629
|
+
): number;
|
|
3630
|
+
/**
|
|
3631
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3632
|
+
*/
|
|
3633
|
+
toReversed(): Float64Array<ArrayBuffer>;
|
|
3634
|
+
/**
|
|
3635
|
+
* Copies and sorts the array.
|
|
3636
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3637
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3638
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3639
|
+
* ```ts
|
|
3640
|
+
* const myNums = Float64Array.from([11.25, 2, -22.5, 1]);
|
|
3641
|
+
* myNums.toSorted((a, b) => a - b) // Float64Array(4) [-22.5, 1, 2, 11.5]
|
|
3642
|
+
* ```
|
|
3643
|
+
*/
|
|
3644
|
+
toSorted(compareFn?: (a: number, b: number) => number): Float64Array<ArrayBuffer>;
|
|
3645
|
+
/**
|
|
3646
|
+
* Copies the array and inserts the given number at the provided index.
|
|
3647
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3648
|
+
* negative, then it replaces from the end of the array.
|
|
3649
|
+
* @param value The value to insert into the copied array.
|
|
3650
|
+
* @returns A copy of the original array with the inserted value.
|
|
3651
|
+
*/
|
|
3652
|
+
with(index: number, value: number): Float64Array<ArrayBuffer>;
|
|
3653
|
+
}
|
|
3654
|
+
interface BigInt64Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3655
|
+
/**
|
|
3656
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3657
|
+
* otherwise.
|
|
3658
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3659
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3660
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3661
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3662
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3663
|
+
*/
|
|
3664
|
+
findLast<S extends bigint>(
|
|
3665
|
+
predicate: (
|
|
3666
|
+
value: bigint,
|
|
3667
|
+
index: number,
|
|
3668
|
+
array: this,
|
|
3669
|
+
) => value is S,
|
|
3670
|
+
thisArg?: any,
|
|
3671
|
+
): S | undefined;
|
|
3672
|
+
findLast(
|
|
3673
|
+
predicate: (
|
|
3674
|
+
value: bigint,
|
|
3675
|
+
index: number,
|
|
3676
|
+
array: this,
|
|
3677
|
+
) => unknown,
|
|
3678
|
+
thisArg?: any,
|
|
3679
|
+
): bigint | undefined;
|
|
3680
|
+
/**
|
|
3681
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3682
|
+
* otherwise.
|
|
3683
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3684
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3685
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3686
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3687
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3688
|
+
*/
|
|
3689
|
+
findLastIndex(
|
|
3690
|
+
predicate: (
|
|
3691
|
+
value: bigint,
|
|
3692
|
+
index: number,
|
|
3693
|
+
array: this,
|
|
3694
|
+
) => unknown,
|
|
3695
|
+
thisArg?: any,
|
|
3696
|
+
): number;
|
|
3697
|
+
/**
|
|
3698
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3699
|
+
*/
|
|
3700
|
+
toReversed(): BigInt64Array<ArrayBuffer>;
|
|
3701
|
+
/**
|
|
3702
|
+
* Copies and sorts the array.
|
|
3703
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3704
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3705
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3706
|
+
* ```ts
|
|
3707
|
+
* const myNums = BigInt64Array.from([11n, 2n, -22n, 1n]);
|
|
3708
|
+
* myNums.toSorted((a, b) => Number(a - b)) // BigInt64Array(4) [-22n, 1n, 2n, 11n]
|
|
3709
|
+
* ```
|
|
3710
|
+
*/
|
|
3711
|
+
toSorted(compareFn?: (a: bigint, b: bigint) => number): BigInt64Array<ArrayBuffer>;
|
|
3712
|
+
/**
|
|
3713
|
+
* Copies the array and inserts the given bigint at the provided index.
|
|
3714
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3715
|
+
* negative, then it replaces from the end of the array.
|
|
3716
|
+
* @param value The value to insert into the copied array.
|
|
3717
|
+
* @returns A copy of the original array with the inserted value.
|
|
3718
|
+
*/
|
|
3719
|
+
with(index: number, value: bigint): BigInt64Array<ArrayBuffer>;
|
|
3720
|
+
}
|
|
3721
|
+
interface BigUint64Array<TArrayBuffer extends ArrayBufferLike> {
|
|
3722
|
+
/**
|
|
3723
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
3724
|
+
* otherwise.
|
|
3725
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
3726
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
3727
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
3728
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3729
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3730
|
+
*/
|
|
3731
|
+
findLast<S extends bigint>(
|
|
3732
|
+
predicate: (
|
|
3733
|
+
value: bigint,
|
|
3734
|
+
index: number,
|
|
3735
|
+
array: this,
|
|
3736
|
+
) => value is S,
|
|
3737
|
+
thisArg?: any,
|
|
3738
|
+
): S | undefined;
|
|
3739
|
+
findLast(
|
|
3740
|
+
predicate: (
|
|
3741
|
+
value: bigint,
|
|
3742
|
+
index: number,
|
|
3743
|
+
array: this,
|
|
3744
|
+
) => unknown,
|
|
3745
|
+
thisArg?: any,
|
|
3746
|
+
): bigint | undefined;
|
|
3747
|
+
/**
|
|
3748
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
3749
|
+
* otherwise.
|
|
3750
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
3751
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
3752
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
3753
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
3754
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
3755
|
+
*/
|
|
3756
|
+
findLastIndex(
|
|
3757
|
+
predicate: (
|
|
3758
|
+
value: bigint,
|
|
3759
|
+
index: number,
|
|
3760
|
+
array: this,
|
|
3761
|
+
) => unknown,
|
|
3762
|
+
thisArg?: any,
|
|
3763
|
+
): number;
|
|
3764
|
+
/**
|
|
3765
|
+
* Copies the array and returns the copy with the elements in reverse order.
|
|
3766
|
+
*/
|
|
3767
|
+
toReversed(): BigUint64Array<ArrayBuffer>;
|
|
3768
|
+
/**
|
|
3769
|
+
* Copies and sorts the array.
|
|
3770
|
+
* @param compareFn Function used to determine the order of the elements. It is expected to return
|
|
3771
|
+
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
|
|
3772
|
+
* value otherwise. If omitted, the elements are sorted in ascending order.
|
|
3773
|
+
* ```ts
|
|
3774
|
+
* const myNums = BigUint64Array.from([11n, 2n, 22n, 1n]);
|
|
3775
|
+
* myNums.toSorted((a, b) => Number(a - b)) // BigUint64Array(4) [1n, 2n, 11n, 22n]
|
|
3776
|
+
* ```
|
|
3777
|
+
*/
|
|
3778
|
+
toSorted(compareFn?: (a: bigint, b: bigint) => number): BigUint64Array<ArrayBuffer>;
|
|
3779
|
+
/**
|
|
3780
|
+
* Copies the array and inserts the given bigint at the provided index.
|
|
3781
|
+
* @param index The index of the value to overwrite. If the index is
|
|
3782
|
+
* negative, then it replaces from the end of the array.
|
|
3783
|
+
* @param value The value to insert into the copied array.
|
|
3784
|
+
* @returns A copy of the original array with the inserted value.
|
|
3785
|
+
*/
|
|
3786
|
+
with(index: number, value: bigint): BigUint64Array<ArrayBuffer>;
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3789
|
+
interface WeakKeyTypes {
|
|
3790
|
+
symbol: symbol;
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
interface MapConstructor {
|
|
3794
|
+
/**
|
|
3795
|
+
* Groups members of an iterable according to the return value of the passed callback.
|
|
3796
|
+
* @param items An iterable.
|
|
3797
|
+
* @param keySelector A callback which will be invoked for each item in items.
|
|
3798
|
+
*/
|
|
3799
|
+
groupBy<K, T>(
|
|
3800
|
+
items: Iterable<T>,
|
|
3801
|
+
keySelector: (item: T, index: number) => K,
|
|
3802
|
+
): Map<K, T[]>;
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
interface ObjectConstructor {
|
|
3806
|
+
/**
|
|
3807
|
+
* Groups members of an iterable according to the return value of the passed callback.
|
|
3808
|
+
* @param items An iterable.
|
|
3809
|
+
* @param keySelector A callback which will be invoked for each item in items.
|
|
3810
|
+
*/
|
|
3811
|
+
groupBy<K extends PropertyKey, T>(
|
|
3812
|
+
items: Iterable<T>,
|
|
3813
|
+
keySelector: (item: T, index: number) => K,
|
|
3814
|
+
): Partial<Record<K, T[]>>;
|
|
3815
|
+
}
|
|
3816
|
+
|
|
3817
|
+
interface PromiseWithResolvers<T> {
|
|
3818
|
+
promise: Promise<T>;
|
|
3819
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
3820
|
+
reject: (reason?: any) => void;
|
|
3821
|
+
}
|
|
3822
|
+
interface PromiseConstructor {
|
|
3823
|
+
/**
|
|
3824
|
+
* Creates a new Promise and returns it in an object, along with its resolve and reject functions.
|
|
3825
|
+
* @returns An object with the properties `promise`, `resolve`, and `reject`.
|
|
3826
|
+
*
|
|
3827
|
+
* ```ts
|
|
3828
|
+
* const { promise, resolve, reject } = Promise.withResolvers<T>();
|
|
3829
|
+
* ```
|
|
3830
|
+
*/
|
|
3831
|
+
withResolvers<T>(): PromiseWithResolvers<T>;
|
|
3832
|
+
}
|
|
3833
|
+
|
|
3834
|
+
interface RegExp {
|
|
3835
|
+
/**
|
|
3836
|
+
* Returns a Boolean value indicating the state of the unicodeSets flag (v) used with a regular expression.
|
|
3837
|
+
* Default is false. Read-only.
|
|
3838
|
+
*/
|
|
3839
|
+
readonly unicodeSets: boolean;
|
|
3840
|
+
}
|
|
3841
|
+
|
|
3842
|
+
interface String {
|
|
3843
|
+
/**
|
|
3844
|
+
* Returns true if all leading surrogates and trailing surrogates appear paired and in order.
|
|
3845
|
+
*/
|
|
3846
|
+
isWellFormed(): boolean;
|
|
3847
|
+
/**
|
|
3848
|
+
* Returns a string where all lone or out-of-order surrogates have been replaced by the Unicode replacement character (U+FFFD).
|
|
3849
|
+
*/
|
|
3850
|
+
toWellFormed(): string;
|
|
3851
|
+
}
|
|
3852
|
+
|
|
2950
3853
|
declare var NaN: number;
|
|
2951
3854
|
declare var Infinity: number;
|
|
2952
3855
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrock-apis/env-types",
|
|
3
|
-
"version": "1.0.0-beta",
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"description": "A collection of environment-specific TypeScript type definitions for engines with non-standard versioning and selective feature support across versions.",
|
|
5
5
|
"main": "",
|
|
6
6
|
"types": "lib.d.ts",
|