@bedrock-apis/env-types 1.0.0-beta → 1.0.0-beta.3

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.
Files changed (4) hide show
  1. package/LICENSE +26 -21
  2. package/README.md +1 -1
  3. package/lib.d.ts +925 -0
  4. package/package.json +11 -3
package/LICENSE CHANGED
@@ -1,21 +1,26 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Bedrock APIs
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ Copyright 2026 Bedrock APIs
8
+
9
+ Licensed under the Apache License, Version 2.0 (the "License");
10
+ you may not use this file except in compliance with the License.
11
+ You may obtain a copy of the License at
12
+
13
+ http://www.apache.org/licenses/LICENSE-2.0
14
+
15
+ Unless required by applicable law or agreed to in writing, software
16
+ distributed under the License is distributed on an "AS IS" BASIS,
17
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ See the License for the specific language governing permissions and
19
+ limitations under the License.
20
+
21
+ ---
22
+
23
+ This project includes content derived from Microsoft's TypeScript standard library declaration files (`lib.es*.d.ts`),
24
+ which are licensed under the Apache License, Version 2.0.
25
+
26
+ Modifications: Portions of the original files have been removed to include only the declarations used by this project.
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
@@ -1,5 +1,27 @@
1
+
2
+ /*! *****************************************************************************
3
+ This file includes content derived from Microsoft's TypeScript standard library
4
+ declaration files (lib.es*.d.ts), licensed under the Apache License, Version 2.0.
5
+
6
+ Modifications include: Portions of the original files have been removed to
7
+ include only the declarations used by this project.
8
+
9
+ Licensed under the Apache License, Version 2.0 (the "License");
10
+ you may not use this file except in compliance with the License.
11
+ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16
+ MERCHANTABILITY OR NON-INFRINGEMENT.
17
+
18
+ See the Apache Version 2.0 License for specific language governing permissions
19
+ and limitations under the License.
20
+ ***************************************************************************** */
21
+
1
22
  /// <reference no-default-lib="true"/>
2
23
 
24
+
3
25
  interface Map<K, V> {
4
26
  clear(): void;
5
27
  /**
@@ -2947,6 +2969,909 @@ interface String {
2947
2969
  replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
2948
2970
  }
2949
2971
 
2972
+ interface Array<T> {
2973
+ /**
2974
+ * Returns the value of the last element in the array where predicate is true, and undefined
2975
+ * otherwise.
2976
+ * @param predicate findLast calls predicate once for each element of the array, in descending
2977
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
2978
+ * immediately returns that element value. Otherwise, findLast returns undefined.
2979
+ * @param thisArg If provided, it will be used as the this value for each invocation of
2980
+ * predicate. If it is not provided, undefined is used instead.
2981
+ */
2982
+ findLast<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S | undefined;
2983
+ findLast(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T | undefined;
2984
+ /**
2985
+ * Returns the index of the last element in the array where predicate is true, and -1
2986
+ * otherwise.
2987
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
2988
+ * order, until it finds one where predicate returns true. If such an element is found,
2989
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
2990
+ * @param thisArg If provided, it will be used as the this value for each invocation of
2991
+ * predicate. If it is not provided, undefined is used instead.
2992
+ */
2993
+ findLastIndex(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): number;
2994
+ /**
2995
+ * Returns a copy of an array with its elements reversed.
2996
+ */
2997
+ toReversed(): T[];
2998
+ /**
2999
+ * Returns a copy of an array with its elements sorted.
3000
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3001
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3002
+ * value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
3003
+ * ```ts
3004
+ * [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
3005
+ * ```
3006
+ */
3007
+ toSorted(compareFn?: (a: T, b: T) => number): T[];
3008
+ /**
3009
+ * Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.
3010
+ * @param start The zero-based location in the array from which to start removing elements.
3011
+ * @param deleteCount The number of elements to remove.
3012
+ * @param items Elements to insert into the copied array in place of the deleted elements.
3013
+ * @returns The copied array.
3014
+ */
3015
+ toSpliced(start: number, deleteCount: number, ...items: T[]): T[];
3016
+ /**
3017
+ * Copies an array and removes elements while returning the remaining elements.
3018
+ * @param start The zero-based location in the array from which to start removing elements.
3019
+ * @param deleteCount The number of elements to remove.
3020
+ * @returns A copy of the original array with the remaining elements.
3021
+ */
3022
+ toSpliced(start: number, deleteCount?: number): T[];
3023
+ /**
3024
+ * Copies an array, then overwrites the value at the provided index with the
3025
+ * given value. If the index is negative, then it replaces from the end
3026
+ * of the array.
3027
+ * @param index The index of the value to overwrite. If the index is
3028
+ * negative, then it replaces from the end of the array.
3029
+ * @param value The value to write into the copied array.
3030
+ * @returns The copied array with the updated value.
3031
+ */
3032
+ with(index: number, value: T): T[];
3033
+ }
3034
+ interface ReadonlyArray<T> {
3035
+ /**
3036
+ * Returns the value of the last element in the array where predicate is true, and undefined
3037
+ * otherwise.
3038
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3039
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3040
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3041
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3042
+ * predicate. If it is not provided, undefined is used instead.
3043
+ */
3044
+ findLast<S extends T>(
3045
+ predicate: (value: T, index: number, array: readonly T[]) => value is S,
3046
+ thisArg?: any,
3047
+ ): S | undefined;
3048
+ findLast(
3049
+ predicate: (value: T, index: number, array: readonly T[]) => unknown,
3050
+ thisArg?: any,
3051
+ ): T | undefined;
3052
+ /**
3053
+ * Returns the index of the last element in the array where predicate is true, and -1
3054
+ * otherwise.
3055
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3056
+ * order, until it finds one where predicate returns true. If such an element is found,
3057
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3058
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3059
+ * predicate. If it is not provided, undefined is used instead.
3060
+ */
3061
+ findLastIndex(
3062
+ predicate: (value: T, index: number, array: readonly T[]) => unknown,
3063
+ thisArg?: any,
3064
+ ): number;
3065
+ /**
3066
+ * Copies the array and returns the copied array with all of its elements reversed.
3067
+ */
3068
+ toReversed(): T[];
3069
+ /**
3070
+ * Copies and sorts the array.
3071
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3072
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3073
+ * value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
3074
+ * ```ts
3075
+ * [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
3076
+ * ```
3077
+ */
3078
+ toSorted(compareFn?: (a: T, b: T) => number): T[];
3079
+ /**
3080
+ * Copies an array and removes elements while, if necessary, inserting new elements in their place, returning the remaining elements.
3081
+ * @param start The zero-based location in the array from which to start removing elements.
3082
+ * @param deleteCount The number of elements to remove.
3083
+ * @param items Elements to insert into the copied array in place of the deleted elements.
3084
+ * @returns A copy of the original array with the remaining elements.
3085
+ */
3086
+ toSpliced(start: number, deleteCount: number, ...items: T[]): T[];
3087
+ /**
3088
+ * Copies an array and removes elements while returning the remaining elements.
3089
+ * @param start The zero-based location in the array from which to start removing elements.
3090
+ * @param deleteCount The number of elements to remove.
3091
+ * @returns A copy of the original array with the remaining elements.
3092
+ */
3093
+ toSpliced(start: number, deleteCount?: number): T[];
3094
+ /**
3095
+ * Copies an array, then overwrites the value at the provided index with the
3096
+ * given value. If the index is negative, then it replaces from the end
3097
+ * of the array
3098
+ * @param index The index of the value to overwrite. If the index is
3099
+ * negative, then it replaces from the end of the array.
3100
+ * @param value The value to insert into the copied array.
3101
+ * @returns A copy of the original array with the inserted value.
3102
+ */
3103
+ with(index: number, value: T): T[];
3104
+ }
3105
+ interface Int8Array<TArrayBuffer extends ArrayBufferLike> {
3106
+ /**
3107
+ * Returns the value of the last element in the array where predicate is true, and undefined
3108
+ * otherwise.
3109
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3110
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3111
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3112
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3113
+ * predicate. If it is not provided, undefined is used instead.
3114
+ */
3115
+ findLast<S extends number>(
3116
+ predicate: (
3117
+ value: number,
3118
+ index: number,
3119
+ array: this,
3120
+ ) => value is S,
3121
+ thisArg?: any,
3122
+ ): S | undefined;
3123
+ findLast(
3124
+ predicate: (value: number, index: number, array: this) => unknown,
3125
+ thisArg?: any,
3126
+ ): number | undefined;
3127
+ /**
3128
+ * Returns the index of the last element in the array where predicate is true, and -1
3129
+ * otherwise.
3130
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3131
+ * order, until it finds one where predicate returns true. If such an element is found,
3132
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3133
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3134
+ * predicate. If it is not provided, undefined is used instead.
3135
+ */
3136
+ findLastIndex(
3137
+ predicate: (value: number, index: number, array: this) => unknown,
3138
+ thisArg?: any,
3139
+ ): number;
3140
+ /**
3141
+ * Copies the array and returns the copy with the elements in reverse order.
3142
+ */
3143
+ toReversed(): Int8Array<ArrayBuffer>;
3144
+ /**
3145
+ * Copies and sorts the array.
3146
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3147
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3148
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3149
+ * ```ts
3150
+ * const myNums = Int8Array.from([11, 2, 22, 1]);
3151
+ * myNums.toSorted((a, b) => a - b) // Int8Array(4) [1, 2, 11, 22]
3152
+ * ```
3153
+ */
3154
+ toSorted(compareFn?: (a: number, b: number) => number): Int8Array<ArrayBuffer>;
3155
+ /**
3156
+ * Copies the array and inserts the given number at the provided index.
3157
+ * @param index The index of the value to overwrite. If the index is
3158
+ * negative, then it replaces from the end of the array.
3159
+ * @param value The value to insert into the copied array.
3160
+ * @returns A copy of the original array with the inserted value.
3161
+ */
3162
+ with(index: number, value: number): Int8Array<ArrayBuffer>;
3163
+ }
3164
+ interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
3165
+ /**
3166
+ * Returns the value of the last element in the array where predicate is true, and undefined
3167
+ * otherwise.
3168
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3169
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3170
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3171
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3172
+ * predicate. If it is not provided, undefined is used instead.
3173
+ */
3174
+ findLast<S extends number>(
3175
+ predicate: (
3176
+ value: number,
3177
+ index: number,
3178
+ array: this,
3179
+ ) => value is S,
3180
+ thisArg?: any,
3181
+ ): S | undefined;
3182
+ findLast(
3183
+ predicate: (value: number, index: number, array: this) => unknown,
3184
+ thisArg?: any,
3185
+ ): number | undefined;
3186
+ /**
3187
+ * Returns the index of the last element in the array where predicate is true, and -1
3188
+ * otherwise.
3189
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3190
+ * order, until it finds one where predicate returns true. If such an element is found,
3191
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3192
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3193
+ * predicate. If it is not provided, undefined is used instead.
3194
+ */
3195
+ findLastIndex(
3196
+ predicate: (value: number, index: number, array: this) => unknown,
3197
+ thisArg?: any,
3198
+ ): number;
3199
+ /**
3200
+ * Copies the array and returns the copy with the elements in reverse order.
3201
+ */
3202
+ toReversed(): Uint8Array<ArrayBuffer>;
3203
+ /**
3204
+ * Copies and sorts the array.
3205
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3206
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3207
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3208
+ * ```ts
3209
+ * const myNums = Uint8Array.from([11, 2, 22, 1]);
3210
+ * myNums.toSorted((a, b) => a - b) // Uint8Array(4) [1, 2, 11, 22]
3211
+ * ```
3212
+ */
3213
+ toSorted(compareFn?: (a: number, b: number) => number): Uint8Array<ArrayBuffer>;
3214
+ /**
3215
+ * Copies the array and inserts the given number at the provided index.
3216
+ * @param index The index of the value to overwrite. If the index is
3217
+ * negative, then it replaces from the end of the array.
3218
+ * @param value The value to insert into the copied array.
3219
+ * @returns A copy of the original array with the inserted value.
3220
+ */
3221
+ with(index: number, value: number): Uint8Array<ArrayBuffer>;
3222
+ }
3223
+ interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {
3224
+ /**
3225
+ * Returns the value of the last element in the array where predicate is true, and undefined
3226
+ * otherwise.
3227
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3228
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3229
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3230
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3231
+ * predicate. If it is not provided, undefined is used instead.
3232
+ */
3233
+ findLast<S extends number>(
3234
+ predicate: (
3235
+ value: number,
3236
+ index: number,
3237
+ array: this,
3238
+ ) => value is S,
3239
+ thisArg?: any,
3240
+ ): S | undefined;
3241
+ findLast(
3242
+ predicate: (
3243
+ value: number,
3244
+ index: number,
3245
+ array: this,
3246
+ ) => unknown,
3247
+ thisArg?: any,
3248
+ ): number | undefined;
3249
+ /**
3250
+ * Returns the index of the last element in the array where predicate is true, and -1
3251
+ * otherwise.
3252
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3253
+ * order, until it finds one where predicate returns true. If such an element is found,
3254
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3255
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3256
+ * predicate. If it is not provided, undefined is used instead.
3257
+ */
3258
+ findLastIndex(
3259
+ predicate: (
3260
+ value: number,
3261
+ index: number,
3262
+ array: this,
3263
+ ) => unknown,
3264
+ thisArg?: any,
3265
+ ): number;
3266
+ /**
3267
+ * Copies the array and returns the copy with the elements in reverse order.
3268
+ */
3269
+ toReversed(): Uint8ClampedArray<ArrayBuffer>;
3270
+ /**
3271
+ * Copies and sorts the array.
3272
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3273
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3274
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3275
+ * ```ts
3276
+ * const myNums = Uint8ClampedArray.from([11, 2, 22, 1]);
3277
+ * myNums.toSorted((a, b) => a - b) // Uint8ClampedArray(4) [1, 2, 11, 22]
3278
+ * ```
3279
+ */
3280
+ toSorted(compareFn?: (a: number, b: number) => number): Uint8ClampedArray<ArrayBuffer>;
3281
+ /**
3282
+ * Copies the array and inserts the given number at the provided index.
3283
+ * @param index The index of the value to overwrite. If the index is
3284
+ * negative, then it replaces from the end of the array.
3285
+ * @param value The value to insert into the copied array.
3286
+ * @returns A copy of the original array with the inserted value.
3287
+ */
3288
+ with(index: number, value: number): Uint8ClampedArray<ArrayBuffer>;
3289
+ }
3290
+ interface Int16Array<TArrayBuffer extends ArrayBufferLike> {
3291
+ /**
3292
+ * Returns the value of the last element in the array where predicate is true, and undefined
3293
+ * otherwise.
3294
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3295
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3296
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3297
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3298
+ * predicate. If it is not provided, undefined is used instead.
3299
+ */
3300
+ findLast<S extends number>(
3301
+ predicate: (
3302
+ value: number,
3303
+ index: number,
3304
+ array: this,
3305
+ ) => value is S,
3306
+ thisArg?: any,
3307
+ ): S | undefined;
3308
+ findLast(
3309
+ predicate: (value: number, index: number, array: this) => unknown,
3310
+ thisArg?: any,
3311
+ ): number | undefined;
3312
+ /**
3313
+ * Returns the index of the last element in the array where predicate is true, and -1
3314
+ * otherwise.
3315
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3316
+ * order, until it finds one where predicate returns true. If such an element is found,
3317
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3318
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3319
+ * predicate. If it is not provided, undefined is used instead.
3320
+ */
3321
+ findLastIndex(
3322
+ predicate: (value: number, index: number, array: this) => unknown,
3323
+ thisArg?: any,
3324
+ ): number;
3325
+ /**
3326
+ * Copies the array and returns the copy with the elements in reverse order.
3327
+ */
3328
+ toReversed(): Int16Array<ArrayBuffer>;
3329
+ /**
3330
+ * Copies and sorts the array.
3331
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3332
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3333
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3334
+ * ```ts
3335
+ * const myNums = Int16Array.from([11, 2, -22, 1]);
3336
+ * myNums.toSorted((a, b) => a - b) // Int16Array(4) [-22, 1, 2, 11]
3337
+ * ```
3338
+ */
3339
+ toSorted(compareFn?: (a: number, b: number) => number): Int16Array<ArrayBuffer>;
3340
+ /**
3341
+ * Copies the array and inserts the given number at the provided index.
3342
+ * @param index The index of the value to overwrite. If the index is
3343
+ * negative, then it replaces from the end of the array.
3344
+ * @param value The value to insert into the copied array.
3345
+ * @returns A copy of the original array with the inserted value.
3346
+ */
3347
+ with(index: number, value: number): Int16Array<ArrayBuffer>;
3348
+ }
3349
+ interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {
3350
+ /**
3351
+ * Returns the value of the last element in the array where predicate is true, and undefined
3352
+ * otherwise.
3353
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3354
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3355
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3356
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3357
+ * predicate. If it is not provided, undefined is used instead.
3358
+ */
3359
+ findLast<S extends number>(
3360
+ predicate: (
3361
+ value: number,
3362
+ index: number,
3363
+ array: this,
3364
+ ) => value is S,
3365
+ thisArg?: any,
3366
+ ): S | undefined;
3367
+ findLast(
3368
+ predicate: (
3369
+ value: number,
3370
+ index: number,
3371
+ array: this,
3372
+ ) => unknown,
3373
+ thisArg?: any,
3374
+ ): number | undefined;
3375
+ /**
3376
+ * Returns the index of the last element in the array where predicate is true, and -1
3377
+ * otherwise.
3378
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3379
+ * order, until it finds one where predicate returns true. If such an element is found,
3380
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3381
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3382
+ * predicate. If it is not provided, undefined is used instead.
3383
+ */
3384
+ findLastIndex(
3385
+ predicate: (
3386
+ value: number,
3387
+ index: number,
3388
+ array: this,
3389
+ ) => unknown,
3390
+ thisArg?: any,
3391
+ ): number;
3392
+ /**
3393
+ * Copies the array and returns the copy with the elements in reverse order.
3394
+ */
3395
+ toReversed(): Uint16Array<ArrayBuffer>;
3396
+ /**
3397
+ * Copies and sorts the array.
3398
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3399
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3400
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3401
+ * ```ts
3402
+ * const myNums = Uint16Array.from([11, 2, 22, 1]);
3403
+ * myNums.toSorted((a, b) => a - b) // Uint16Array(4) [1, 2, 11, 22]
3404
+ * ```
3405
+ */
3406
+ toSorted(compareFn?: (a: number, b: number) => number): Uint16Array<ArrayBuffer>;
3407
+ /**
3408
+ * Copies the array and inserts the given number at the provided index.
3409
+ * @param index The index of the value to overwrite. If the index is
3410
+ * negative, then it replaces from the end of the array.
3411
+ * @param value The value to insert into the copied array.
3412
+ * @returns A copy of the original array with the inserted value.
3413
+ */
3414
+ with(index: number, value: number): Uint16Array<ArrayBuffer>;
3415
+ }
3416
+ interface Int32Array<TArrayBuffer extends ArrayBufferLike> {
3417
+ /**
3418
+ * Returns the value of the last element in the array where predicate is true, and undefined
3419
+ * otherwise.
3420
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3421
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3422
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3423
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3424
+ * predicate. If it is not provided, undefined is used instead.
3425
+ */
3426
+ findLast<S extends number>(
3427
+ predicate: (
3428
+ value: number,
3429
+ index: number,
3430
+ array: this,
3431
+ ) => value is S,
3432
+ thisArg?: any,
3433
+ ): S | undefined;
3434
+ findLast(
3435
+ predicate: (value: number, index: number, array: this) => unknown,
3436
+ thisArg?: any,
3437
+ ): number | undefined;
3438
+ /**
3439
+ * Returns the index of the last element in the array where predicate is true, and -1
3440
+ * otherwise.
3441
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3442
+ * order, until it finds one where predicate returns true. If such an element is found,
3443
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3444
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3445
+ * predicate. If it is not provided, undefined is used instead.
3446
+ */
3447
+ findLastIndex(
3448
+ predicate: (value: number, index: number, array: this) => unknown,
3449
+ thisArg?: any,
3450
+ ): number;
3451
+ /**
3452
+ * Copies the array and returns the copy with the elements in reverse order.
3453
+ */
3454
+ toReversed(): Int32Array<ArrayBuffer>;
3455
+ /**
3456
+ * Copies and sorts the array.
3457
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3458
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3459
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3460
+ * ```ts
3461
+ * const myNums = Int32Array.from([11, 2, -22, 1]);
3462
+ * myNums.toSorted((a, b) => a - b) // Int32Array(4) [-22, 1, 2, 11]
3463
+ * ```
3464
+ */
3465
+ toSorted(compareFn?: (a: number, b: number) => number): Int32Array<ArrayBuffer>;
3466
+ /**
3467
+ * Copies the array and inserts the given number at the provided index.
3468
+ * @param index The index of the value to overwrite. If the index is
3469
+ * negative, then it replaces from the end of the array.
3470
+ * @param value The value to insert into the copied array.
3471
+ * @returns A copy of the original array with the inserted value.
3472
+ */
3473
+ with(index: number, value: number): Int32Array<ArrayBuffer>;
3474
+ }
3475
+ interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {
3476
+ /**
3477
+ * Returns the value of the last element in the array where predicate is true, and undefined
3478
+ * otherwise.
3479
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3480
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3481
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3482
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3483
+ * predicate. If it is not provided, undefined is used instead.
3484
+ */
3485
+ findLast<S extends number>(
3486
+ predicate: (
3487
+ value: number,
3488
+ index: number,
3489
+ array: this,
3490
+ ) => value is S,
3491
+ thisArg?: any,
3492
+ ): S | undefined;
3493
+ findLast(
3494
+ predicate: (
3495
+ value: number,
3496
+ index: number,
3497
+ array: this,
3498
+ ) => unknown,
3499
+ thisArg?: any,
3500
+ ): number | undefined;
3501
+ /**
3502
+ * Returns the index of the last element in the array where predicate is true, and -1
3503
+ * otherwise.
3504
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3505
+ * order, until it finds one where predicate returns true. If such an element is found,
3506
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3507
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3508
+ * predicate. If it is not provided, undefined is used instead.
3509
+ */
3510
+ findLastIndex(
3511
+ predicate: (
3512
+ value: number,
3513
+ index: number,
3514
+ array: this,
3515
+ ) => unknown,
3516
+ thisArg?: any,
3517
+ ): number;
3518
+ /**
3519
+ * Copies the array and returns the copy with the elements in reverse order.
3520
+ */
3521
+ toReversed(): Uint32Array<ArrayBuffer>;
3522
+ /**
3523
+ * Copies and sorts the array.
3524
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3525
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3526
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3527
+ * ```ts
3528
+ * const myNums = Uint32Array.from([11, 2, 22, 1]);
3529
+ * myNums.toSorted((a, b) => a - b) // Uint32Array(4) [1, 2, 11, 22]
3530
+ * ```
3531
+ */
3532
+ toSorted(compareFn?: (a: number, b: number) => number): Uint32Array<ArrayBuffer>;
3533
+ /**
3534
+ * Copies the array and inserts the given number at the provided index.
3535
+ * @param index The index of the value to overwrite. If the index is
3536
+ * negative, then it replaces from the end of the array.
3537
+ * @param value The value to insert into the copied array.
3538
+ * @returns A copy of the original array with the inserted value.
3539
+ */
3540
+ with(index: number, value: number): Uint32Array<ArrayBuffer>;
3541
+ }
3542
+ interface Float32Array<TArrayBuffer extends ArrayBufferLike> {
3543
+ /**
3544
+ * Returns the value of the last element in the array where predicate is true, and undefined
3545
+ * otherwise.
3546
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3547
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3548
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3549
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3550
+ * predicate. If it is not provided, undefined is used instead.
3551
+ */
3552
+ findLast<S extends number>(
3553
+ predicate: (
3554
+ value: number,
3555
+ index: number,
3556
+ array: this,
3557
+ ) => value is S,
3558
+ thisArg?: any,
3559
+ ): S | undefined;
3560
+ findLast(
3561
+ predicate: (
3562
+ value: number,
3563
+ index: number,
3564
+ array: this,
3565
+ ) => unknown,
3566
+ thisArg?: any,
3567
+ ): number | undefined;
3568
+ /**
3569
+ * Returns the index of the last element in the array where predicate is true, and -1
3570
+ * otherwise.
3571
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3572
+ * order, until it finds one where predicate returns true. If such an element is found,
3573
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3574
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3575
+ * predicate. If it is not provided, undefined is used instead.
3576
+ */
3577
+ findLastIndex(
3578
+ predicate: (
3579
+ value: number,
3580
+ index: number,
3581
+ array: this,
3582
+ ) => unknown,
3583
+ thisArg?: any,
3584
+ ): number;
3585
+ /**
3586
+ * Copies the array and returns the copy with the elements in reverse order.
3587
+ */
3588
+ toReversed(): Float32Array<ArrayBuffer>;
3589
+ /**
3590
+ * Copies and sorts the array.
3591
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3592
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3593
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3594
+ * ```ts
3595
+ * const myNums = Float32Array.from([11.25, 2, -22.5, 1]);
3596
+ * myNums.toSorted((a, b) => a - b) // Float32Array(4) [-22.5, 1, 2, 11.5]
3597
+ * ```
3598
+ */
3599
+ toSorted(compareFn?: (a: number, b: number) => number): Float32Array<ArrayBuffer>;
3600
+ /**
3601
+ * Copies the array and inserts the given number at the provided index.
3602
+ * @param index The index of the value to overwrite. If the index is
3603
+ * negative, then it replaces from the end of the array.
3604
+ * @param value The value to insert into the copied array.
3605
+ * @returns A copy of the original array with the inserted value.
3606
+ */
3607
+ with(index: number, value: number): Float32Array<ArrayBuffer>;
3608
+ }
3609
+ interface Float64Array<TArrayBuffer extends ArrayBufferLike> {
3610
+ /**
3611
+ * Returns the value of the last element in the array where predicate is true, and undefined
3612
+ * otherwise.
3613
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3614
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3615
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3616
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3617
+ * predicate. If it is not provided, undefined is used instead.
3618
+ */
3619
+ findLast<S extends number>(
3620
+ predicate: (
3621
+ value: number,
3622
+ index: number,
3623
+ array: this,
3624
+ ) => value is S,
3625
+ thisArg?: any,
3626
+ ): S | undefined;
3627
+ findLast(
3628
+ predicate: (
3629
+ value: number,
3630
+ index: number,
3631
+ array: this,
3632
+ ) => unknown,
3633
+ thisArg?: any,
3634
+ ): number | undefined;
3635
+ /**
3636
+ * Returns the index of the last element in the array where predicate is true, and -1
3637
+ * otherwise.
3638
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3639
+ * order, until it finds one where predicate returns true. If such an element is found,
3640
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3641
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3642
+ * predicate. If it is not provided, undefined is used instead.
3643
+ */
3644
+ findLastIndex(
3645
+ predicate: (
3646
+ value: number,
3647
+ index: number,
3648
+ array: this,
3649
+ ) => unknown,
3650
+ thisArg?: any,
3651
+ ): number;
3652
+ /**
3653
+ * Copies the array and returns the copy with the elements in reverse order.
3654
+ */
3655
+ toReversed(): Float64Array<ArrayBuffer>;
3656
+ /**
3657
+ * Copies and sorts the array.
3658
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3659
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3660
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3661
+ * ```ts
3662
+ * const myNums = Float64Array.from([11.25, 2, -22.5, 1]);
3663
+ * myNums.toSorted((a, b) => a - b) // Float64Array(4) [-22.5, 1, 2, 11.5]
3664
+ * ```
3665
+ */
3666
+ toSorted(compareFn?: (a: number, b: number) => number): Float64Array<ArrayBuffer>;
3667
+ /**
3668
+ * Copies the array and inserts the given number at the provided index.
3669
+ * @param index The index of the value to overwrite. If the index is
3670
+ * negative, then it replaces from the end of the array.
3671
+ * @param value The value to insert into the copied array.
3672
+ * @returns A copy of the original array with the inserted value.
3673
+ */
3674
+ with(index: number, value: number): Float64Array<ArrayBuffer>;
3675
+ }
3676
+ interface BigInt64Array<TArrayBuffer extends ArrayBufferLike> {
3677
+ /**
3678
+ * Returns the value of the last element in the array where predicate is true, and undefined
3679
+ * otherwise.
3680
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3681
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3682
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3683
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3684
+ * predicate. If it is not provided, undefined is used instead.
3685
+ */
3686
+ findLast<S extends bigint>(
3687
+ predicate: (
3688
+ value: bigint,
3689
+ index: number,
3690
+ array: this,
3691
+ ) => value is S,
3692
+ thisArg?: any,
3693
+ ): S | undefined;
3694
+ findLast(
3695
+ predicate: (
3696
+ value: bigint,
3697
+ index: number,
3698
+ array: this,
3699
+ ) => unknown,
3700
+ thisArg?: any,
3701
+ ): bigint | undefined;
3702
+ /**
3703
+ * Returns the index of the last element in the array where predicate is true, and -1
3704
+ * otherwise.
3705
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3706
+ * order, until it finds one where predicate returns true. If such an element is found,
3707
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3708
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3709
+ * predicate. If it is not provided, undefined is used instead.
3710
+ */
3711
+ findLastIndex(
3712
+ predicate: (
3713
+ value: bigint,
3714
+ index: number,
3715
+ array: this,
3716
+ ) => unknown,
3717
+ thisArg?: any,
3718
+ ): number;
3719
+ /**
3720
+ * Copies the array and returns the copy with the elements in reverse order.
3721
+ */
3722
+ toReversed(): BigInt64Array<ArrayBuffer>;
3723
+ /**
3724
+ * Copies and sorts the array.
3725
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3726
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3727
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3728
+ * ```ts
3729
+ * const myNums = BigInt64Array.from([11n, 2n, -22n, 1n]);
3730
+ * myNums.toSorted((a, b) => Number(a - b)) // BigInt64Array(4) [-22n, 1n, 2n, 11n]
3731
+ * ```
3732
+ */
3733
+ toSorted(compareFn?: (a: bigint, b: bigint) => number): BigInt64Array<ArrayBuffer>;
3734
+ /**
3735
+ * Copies the array and inserts the given bigint at the provided index.
3736
+ * @param index The index of the value to overwrite. If the index is
3737
+ * negative, then it replaces from the end of the array.
3738
+ * @param value The value to insert into the copied array.
3739
+ * @returns A copy of the original array with the inserted value.
3740
+ */
3741
+ with(index: number, value: bigint): BigInt64Array<ArrayBuffer>;
3742
+ }
3743
+ interface BigUint64Array<TArrayBuffer extends ArrayBufferLike> {
3744
+ /**
3745
+ * Returns the value of the last element in the array where predicate is true, and undefined
3746
+ * otherwise.
3747
+ * @param predicate findLast calls predicate once for each element of the array, in descending
3748
+ * order, until it finds one where predicate returns true. If such an element is found, findLast
3749
+ * immediately returns that element value. Otherwise, findLast returns undefined.
3750
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3751
+ * predicate. If it is not provided, undefined is used instead.
3752
+ */
3753
+ findLast<S extends bigint>(
3754
+ predicate: (
3755
+ value: bigint,
3756
+ index: number,
3757
+ array: this,
3758
+ ) => value is S,
3759
+ thisArg?: any,
3760
+ ): S | undefined;
3761
+ findLast(
3762
+ predicate: (
3763
+ value: bigint,
3764
+ index: number,
3765
+ array: this,
3766
+ ) => unknown,
3767
+ thisArg?: any,
3768
+ ): bigint | undefined;
3769
+ /**
3770
+ * Returns the index of the last element in the array where predicate is true, and -1
3771
+ * otherwise.
3772
+ * @param predicate findLastIndex calls predicate once for each element of the array, in descending
3773
+ * order, until it finds one where predicate returns true. If such an element is found,
3774
+ * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
3775
+ * @param thisArg If provided, it will be used as the this value for each invocation of
3776
+ * predicate. If it is not provided, undefined is used instead.
3777
+ */
3778
+ findLastIndex(
3779
+ predicate: (
3780
+ value: bigint,
3781
+ index: number,
3782
+ array: this,
3783
+ ) => unknown,
3784
+ thisArg?: any,
3785
+ ): number;
3786
+ /**
3787
+ * Copies the array and returns the copy with the elements in reverse order.
3788
+ */
3789
+ toReversed(): BigUint64Array<ArrayBuffer>;
3790
+ /**
3791
+ * Copies and sorts the array.
3792
+ * @param compareFn Function used to determine the order of the elements. It is expected to return
3793
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
3794
+ * value otherwise. If omitted, the elements are sorted in ascending order.
3795
+ * ```ts
3796
+ * const myNums = BigUint64Array.from([11n, 2n, 22n, 1n]);
3797
+ * myNums.toSorted((a, b) => Number(a - b)) // BigUint64Array(4) [1n, 2n, 11n, 22n]
3798
+ * ```
3799
+ */
3800
+ toSorted(compareFn?: (a: bigint, b: bigint) => number): BigUint64Array<ArrayBuffer>;
3801
+ /**
3802
+ * Copies the array and inserts the given bigint at the provided index.
3803
+ * @param index The index of the value to overwrite. If the index is
3804
+ * negative, then it replaces from the end of the array.
3805
+ * @param value The value to insert into the copied array.
3806
+ * @returns A copy of the original array with the inserted value.
3807
+ */
3808
+ with(index: number, value: bigint): BigUint64Array<ArrayBuffer>;
3809
+ }
3810
+
3811
+ interface WeakKeyTypes {
3812
+ symbol: symbol;
3813
+ }
3814
+
3815
+ interface MapConstructor {
3816
+ /**
3817
+ * Groups members of an iterable according to the return value of the passed callback.
3818
+ * @param items An iterable.
3819
+ * @param keySelector A callback which will be invoked for each item in items.
3820
+ */
3821
+ groupBy<K, T>(
3822
+ items: Iterable<T>,
3823
+ keySelector: (item: T, index: number) => K,
3824
+ ): Map<K, T[]>;
3825
+ }
3826
+
3827
+ interface ObjectConstructor {
3828
+ /**
3829
+ * Groups members of an iterable according to the return value of the passed callback.
3830
+ * @param items An iterable.
3831
+ * @param keySelector A callback which will be invoked for each item in items.
3832
+ */
3833
+ groupBy<K extends PropertyKey, T>(
3834
+ items: Iterable<T>,
3835
+ keySelector: (item: T, index: number) => K,
3836
+ ): Partial<Record<K, T[]>>;
3837
+ }
3838
+
3839
+ interface PromiseWithResolvers<T> {
3840
+ promise: Promise<T>;
3841
+ resolve: (value: T | PromiseLike<T>) => void;
3842
+ reject: (reason?: any) => void;
3843
+ }
3844
+ interface PromiseConstructor {
3845
+ /**
3846
+ * Creates a new Promise and returns it in an object, along with its resolve and reject functions.
3847
+ * @returns An object with the properties `promise`, `resolve`, and `reject`.
3848
+ *
3849
+ * ```ts
3850
+ * const { promise, resolve, reject } = Promise.withResolvers<T>();
3851
+ * ```
3852
+ */
3853
+ withResolvers<T>(): PromiseWithResolvers<T>;
3854
+ }
3855
+
3856
+ interface RegExp {
3857
+ /**
3858
+ * Returns a Boolean value indicating the state of the unicodeSets flag (v) used with a regular expression.
3859
+ * Default is false. Read-only.
3860
+ */
3861
+ readonly unicodeSets: boolean;
3862
+ }
3863
+
3864
+ interface String {
3865
+ /**
3866
+ * Returns true if all leading surrogates and trailing surrogates appear paired and in order.
3867
+ */
3868
+ isWellFormed(): boolean;
3869
+ /**
3870
+ * Returns a string where all lone or out-of-order surrogates have been replaced by the Unicode replacement character (U+FFFD).
3871
+ */
3872
+ toWellFormed(): string;
3873
+ }
3874
+
2950
3875
  declare var NaN: number;
2951
3876
  declare var Infinity: number;
2952
3877
  /**
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.3",
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",
@@ -17,6 +17,14 @@
17
17
  "./package.json"
18
18
  ],
19
19
  "author": "bedrock-apis",
20
- "license": "MIT",
21
- "packageManager": "pnpm@10.20.0"
20
+ "license": "Apache-2.0",
21
+ "packageManager": "pnpm@10.20.0",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/bedrock-apis/env-types.git"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/bedrock-apis/env-types/issues"
28
+ },
29
+ "homepage": "https://github.com/bedrock-apis/env-types#readme"
22
30
  }