AK-21/Graphite-Industrial-Intelligence
0
1/*! *****************************************************************************2Copyright (c) Microsoft Corporation. All rights reserved.3Licensed under the Apache License, Version 2.0 (the "License"); you may not use4this file except in compliance with the License. You may obtain a copy of the5License at http://www.apache.org/licenses/LICENSE-2.06 7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,10MERCHANTABILITY OR NON-INFRINGEMENT.11 12See the Apache Version 2.0 License for specific language governing permissions13and limitations under the License.14***************************************************************************** */15 16 17interface Array<T> {18 /**19 * Returns the value of the last element in the array where predicate is true, and undefined20 * otherwise.21 * @param predicate findLast calls predicate once for each element of the array, in descending22 * order, until it finds one where predicate returns true. If such an element is found, findLast23 * immediately returns that element value. Otherwise, findLast returns undefined.24 * @param thisArg If provided, it will be used as the this value for each invocation of25 * predicate. If it is not provided, undefined is used instead.26 */27 findLast<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S | undefined;28 findLast(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T | undefined;29 30 /**31 * Returns the index of the last element in the array where predicate is true, and -132 * otherwise.33 * @param predicate findLastIndex calls predicate once for each element of the array, in descending34 * order, until it finds one where predicate returns true. If such an element is found,35 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.36 * @param thisArg If provided, it will be used as the this value for each invocation of37 * predicate. If it is not provided, undefined is used instead.38 */39 findLastIndex(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): number;40 41 /**42 * Returns a copy of an array with its elements reversed.43 */44 toReversed(): T[];45 46 /**47 * Returns a copy of an array with its elements sorted.48 * @param compareFn Function used to determine the order of the elements. It is expected to return49 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive50 * value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.51 * ```ts52 * [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]53 * ```54 */55 toSorted(compareFn?: (a: T, b: T) => number): T[];56 57 /**58 * Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.59 * @param start The zero-based location in the array from which to start removing elements.60 * @param deleteCount The number of elements to remove.61 * @param items Elements to insert into the copied array in place of the deleted elements.62 * @returns The copied array.63 */64 toSpliced(start: number, deleteCount: number, ...items: T[]): T[];65 66 /**67 * Copies an array and removes elements while returning the remaining elements.68 * @param start The zero-based location in the array from which to start removing elements.69 * @param deleteCount The number of elements to remove.70 * @returns A copy of the original array with the remaining elements.71 */72 toSpliced(start: number, deleteCount?: number): T[];73 74 /**75 * Copies an array, then overwrites the value at the provided index with the76 * given value. If the index is negative, then it replaces from the end77 * of the array.78 * @param index The index of the value to overwrite. If the index is79 * negative, then it replaces from the end of the array.80 * @param value The value to write into the copied array.81 * @returns The copied array with the updated value.82 */83 with(index: number, value: T): T[];84}85 86interface ReadonlyArray<T> {87 /**88 * Returns the value of the last element in the array where predicate is true, and undefined89 * otherwise.90 * @param predicate findLast calls predicate once for each element of the array, in descending91 * order, until it finds one where predicate returns true. If such an element is found, findLast92 * immediately returns that element value. Otherwise, findLast returns undefined.93 * @param thisArg If provided, it will be used as the this value for each invocation of94 * predicate. If it is not provided, undefined is used instead.95 */96 findLast<S extends T>(97 predicate: (value: T, index: number, array: readonly T[]) => value is S,98 thisArg?: any,99 ): S | undefined;100 findLast(101 predicate: (value: T, index: number, array: readonly T[]) => unknown,102 thisArg?: any,103 ): T | undefined;104 105 /**106 * Returns the index of the last element in the array where predicate is true, and -1107 * otherwise.108 * @param predicate findLastIndex calls predicate once for each element of the array, in descending109 * order, until it finds one where predicate returns true. If such an element is found,110 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.111 * @param thisArg If provided, it will be used as the this value for each invocation of112 * predicate. If it is not provided, undefined is used instead.113 */114 findLastIndex(115 predicate: (value: T, index: number, array: readonly T[]) => unknown,116 thisArg?: any,117 ): number;118 119 /**120 * Copies the array and returns the copied array with all of its elements reversed.121 */122 toReversed(): T[];123 124 /**125 * Copies and sorts the array.126 * @param compareFn Function used to determine the order of the elements. It is expected to return127 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive128 * value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.129 * ```ts130 * [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]131 * ```132 */133 toSorted(compareFn?: (a: T, b: T) => number): T[];134 135 /**136 * Copies an array and removes elements while, if necessary, inserting new elements in their place, returning the remaining elements.137 * @param start The zero-based location in the array from which to start removing elements.138 * @param deleteCount The number of elements to remove.139 * @param items Elements to insert into the copied array in place of the deleted elements.140 * @returns A copy of the original array with the remaining elements.141 */142 toSpliced(start: number, deleteCount: number, ...items: T[]): T[];143 144 /**145 * Copies an array and removes elements while returning the remaining elements.146 * @param start The zero-based location in the array from which to start removing elements.147 * @param deleteCount The number of elements to remove.148 * @returns A copy of the original array with the remaining elements.149 */150 toSpliced(start: number, deleteCount?: number): T[];151 152 /**153 * Copies an array, then overwrites the value at the provided index with the154 * given value. If the index is negative, then it replaces from the end155 * of the array156 * @param index The index of the value to overwrite. If the index is157 * negative, then it replaces from the end of the array.158 * @param value The value to insert into the copied array.159 * @returns A copy of the original array with the inserted value.160 */161 with(index: number, value: T): T[];162}163 164interface Int8Array<TArrayBuffer extends ArrayBufferLike> {165 /**166 * Returns the value of the last element in the array where predicate is true, and undefined167 * otherwise.168 * @param predicate findLast calls predicate once for each element of the array, in descending169 * order, until it finds one where predicate returns true. If such an element is found, findLast170 * immediately returns that element value. Otherwise, findLast returns undefined.171 * @param thisArg If provided, it will be used as the this value for each invocation of172 * predicate. If it is not provided, undefined is used instead.173 */174 findLast<S extends number>(175 predicate: (176 value: number,177 index: number,178 array: this,179 ) => value is S,180 thisArg?: any,181 ): S | undefined;182 findLast(183 predicate: (value: number, index: number, array: this) => unknown,184 thisArg?: any,185 ): number | undefined;186 187 /**188 * Returns the index of the last element in the array where predicate is true, and -1189 * otherwise.190 * @param predicate findLastIndex calls predicate once for each element of the array, in descending191 * order, until it finds one where predicate returns true. If such an element is found,192 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.193 * @param thisArg If provided, it will be used as the this value for each invocation of194 * predicate. If it is not provided, undefined is used instead.195 */196 findLastIndex(197 predicate: (value: number, index: number, array: this) => unknown,198 thisArg?: any,199 ): number;200 201 /**202 * Copies the array and returns the copy with the elements in reverse order.203 */204 toReversed(): Int8Array<ArrayBuffer>;205 206 /**207 * Copies and sorts the array.208 * @param compareFn Function used to determine the order of the elements. It is expected to return209 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive210 * value otherwise. If omitted, the elements are sorted in ascending order.211 * ```ts212 * const myNums = Int8Array.from([11, 2, 22, 1]);213 * myNums.toSorted((a, b) => a - b) // Int8Array(4) [1, 2, 11, 22]214 * ```215 */216 toSorted(compareFn?: (a: number, b: number) => number): Int8Array<ArrayBuffer>;217 218 /**219 * Copies the array and inserts the given number at the provided index.220 * @param index The index of the value to overwrite. If the index is221 * negative, then it replaces from the end of the array.222 * @param value The value to insert into the copied array.223 * @returns A copy of the original array with the inserted value.224 */225 with(index: number, value: number): Int8Array<ArrayBuffer>;226}227 228interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {229 /**230 * Returns the value of the last element in the array where predicate is true, and undefined231 * otherwise.232 * @param predicate findLast calls predicate once for each element of the array, in descending233 * order, until it finds one where predicate returns true. If such an element is found, findLast234 * immediately returns that element value. Otherwise, findLast returns undefined.235 * @param thisArg If provided, it will be used as the this value for each invocation of236 * predicate. If it is not provided, undefined is used instead.237 */238 findLast<S extends number>(239 predicate: (240 value: number,241 index: number,242 array: this,243 ) => value is S,244 thisArg?: any,245 ): S | undefined;246 findLast(247 predicate: (value: number, index: number, array: this) => unknown,248 thisArg?: any,249 ): number | undefined;250 251 /**252 * Returns the index of the last element in the array where predicate is true, and -1253 * otherwise.254 * @param predicate findLastIndex calls predicate once for each element of the array, in descending255 * order, until it finds one where predicate returns true. If such an element is found,256 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.257 * @param thisArg If provided, it will be used as the this value for each invocation of258 * predicate. If it is not provided, undefined is used instead.259 */260 findLastIndex(261 predicate: (value: number, index: number, array: this) => unknown,262 thisArg?: any,263 ): number;264 265 /**266 * Copies the array and returns the copy with the elements in reverse order.267 */268 toReversed(): Uint8Array<ArrayBuffer>;269 270 /**271 * Copies and sorts the array.272 * @param compareFn Function used to determine the order of the elements. It is expected to return273 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive274 * value otherwise. If omitted, the elements are sorted in ascending order.275 * ```ts276 * const myNums = Uint8Array.from([11, 2, 22, 1]);277 * myNums.toSorted((a, b) => a - b) // Uint8Array(4) [1, 2, 11, 22]278 * ```279 */280 toSorted(compareFn?: (a: number, b: number) => number): Uint8Array<ArrayBuffer>;281 282 /**283 * Copies the array and inserts the given number at the provided index.284 * @param index The index of the value to overwrite. If the index is285 * negative, then it replaces from the end of the array.286 * @param value The value to insert into the copied array.287 * @returns A copy of the original array with the inserted value.288 */289 with(index: number, value: number): Uint8Array<ArrayBuffer>;290}291 292interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {293 /**294 * Returns the value of the last element in the array where predicate is true, and undefined295 * otherwise.296 * @param predicate findLast calls predicate once for each element of the array, in descending297 * order, until it finds one where predicate returns true. If such an element is found, findLast298 * immediately returns that element value. Otherwise, findLast returns undefined.299 * @param thisArg If provided, it will be used as the this value for each invocation of300 * predicate. If it is not provided, undefined is used instead.301 */302 findLast<S extends number>(303 predicate: (304 value: number,305 index: number,306 array: this,307 ) => value is S,308 thisArg?: any,309 ): S | undefined;310 findLast(311 predicate: (312 value: number,313 index: number,314 array: this,315 ) => unknown,316 thisArg?: any,317 ): number | undefined;318 319 /**320 * Returns the index of the last element in the array where predicate is true, and -1321 * otherwise.322 * @param predicate findLastIndex calls predicate once for each element of the array, in descending323 * order, until it finds one where predicate returns true. If such an element is found,324 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.325 * @param thisArg If provided, it will be used as the this value for each invocation of326 * predicate. If it is not provided, undefined is used instead.327 */328 findLastIndex(329 predicate: (330 value: number,331 index: number,332 array: this,333 ) => unknown,334 thisArg?: any,335 ): number;336 337 /**338 * Copies the array and returns the copy with the elements in reverse order.339 */340 toReversed(): Uint8ClampedArray<ArrayBuffer>;341 342 /**343 * Copies and sorts the array.344 * @param compareFn Function used to determine the order of the elements. It is expected to return345 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive346 * value otherwise. If omitted, the elements are sorted in ascending order.347 * ```ts348 * const myNums = Uint8ClampedArray.from([11, 2, 22, 1]);349 * myNums.toSorted((a, b) => a - b) // Uint8ClampedArray(4) [1, 2, 11, 22]350 * ```351 */352 toSorted(compareFn?: (a: number, b: number) => number): Uint8ClampedArray<ArrayBuffer>;353 354 /**355 * Copies the array and inserts the given number at the provided index.356 * @param index The index of the value to overwrite. If the index is357 * negative, then it replaces from the end of the array.358 * @param value The value to insert into the copied array.359 * @returns A copy of the original array with the inserted value.360 */361 with(index: number, value: number): Uint8ClampedArray<ArrayBuffer>;362}363 364interface Int16Array<TArrayBuffer extends ArrayBufferLike> {365 /**366 * Returns the value of the last element in the array where predicate is true, and undefined367 * otherwise.368 * @param predicate findLast calls predicate once for each element of the array, in descending369 * order, until it finds one where predicate returns true. If such an element is found, findLast370 * immediately returns that element value. Otherwise, findLast returns undefined.371 * @param thisArg If provided, it will be used as the this value for each invocation of372 * predicate. If it is not provided, undefined is used instead.373 */374 findLast<S extends number>(375 predicate: (376 value: number,377 index: number,378 array: this,379 ) => value is S,380 thisArg?: any,381 ): S | undefined;382 findLast(383 predicate: (value: number, index: number, array: this) => unknown,384 thisArg?: any,385 ): number | undefined;386 387 /**388 * Returns the index of the last element in the array where predicate is true, and -1389 * otherwise.390 * @param predicate findLastIndex calls predicate once for each element of the array, in descending391 * order, until it finds one where predicate returns true. If such an element is found,392 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.393 * @param thisArg If provided, it will be used as the this value for each invocation of394 * predicate. If it is not provided, undefined is used instead.395 */396 findLastIndex(397 predicate: (value: number, index: number, array: this) => unknown,398 thisArg?: any,399 ): number;400 401 /**402 * Copies the array and returns the copy with the elements in reverse order.403 */404 toReversed(): Int16Array<ArrayBuffer>;405 406 /**407 * Copies and sorts the array.408 * @param compareFn Function used to determine the order of the elements. It is expected to return409 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive410 * value otherwise. If omitted, the elements are sorted in ascending order.411 * ```ts412 * const myNums = Int16Array.from([11, 2, -22, 1]);413 * myNums.toSorted((a, b) => a - b) // Int16Array(4) [-22, 1, 2, 11]414 * ```415 */416 toSorted(compareFn?: (a: number, b: number) => number): Int16Array<ArrayBuffer>;417 418 /**419 * Copies the array and inserts the given number at the provided index.420 * @param index The index of the value to overwrite. If the index is421 * negative, then it replaces from the end of the array.422 * @param value The value to insert into the copied array.423 * @returns A copy of the original array with the inserted value.424 */425 with(index: number, value: number): Int16Array<ArrayBuffer>;426}427 428interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {429 /**430 * Returns the value of the last element in the array where predicate is true, and undefined431 * otherwise.432 * @param predicate findLast calls predicate once for each element of the array, in descending433 * order, until it finds one where predicate returns true. If such an element is found, findLast434 * immediately returns that element value. Otherwise, findLast returns undefined.435 * @param thisArg If provided, it will be used as the this value for each invocation of436 * predicate. If it is not provided, undefined is used instead.437 */438 findLast<S extends number>(439 predicate: (440 value: number,441 index: number,442 array: this,443 ) => value is S,444 thisArg?: any,445 ): S | undefined;446 findLast(447 predicate: (448 value: number,449 index: number,450 array: this,451 ) => unknown,452 thisArg?: any,453 ): number | undefined;454 455 /**456 * Returns the index of the last element in the array where predicate is true, and -1457 * otherwise.458 * @param predicate findLastIndex calls predicate once for each element of the array, in descending459 * order, until it finds one where predicate returns true. If such an element is found,460 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.461 * @param thisArg If provided, it will be used as the this value for each invocation of462 * predicate. If it is not provided, undefined is used instead.463 */464 findLastIndex(465 predicate: (466 value: number,467 index: number,468 array: this,469 ) => unknown,470 thisArg?: any,471 ): number;472 473 /**474 * Copies the array and returns the copy with the elements in reverse order.475 */476 toReversed(): Uint16Array<ArrayBuffer>;477 478 /**479 * Copies and sorts the array.480 * @param compareFn Function used to determine the order of the elements. It is expected to return481 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive482 * value otherwise. If omitted, the elements are sorted in ascending order.483 * ```ts484 * const myNums = Uint16Array.from([11, 2, 22, 1]);485 * myNums.toSorted((a, b) => a - b) // Uint16Array(4) [1, 2, 11, 22]486 * ```487 */488 toSorted(compareFn?: (a: number, b: number) => number): Uint16Array<ArrayBuffer>;489 490 /**491 * Copies the array and inserts the given number at the provided index.492 * @param index The index of the value to overwrite. If the index is493 * negative, then it replaces from the end of the array.494 * @param value The value to insert into the copied array.495 * @returns A copy of the original array with the inserted value.496 */497 with(index: number, value: number): Uint16Array<ArrayBuffer>;498}499 500interface Int32Array<TArrayBuffer extends ArrayBufferLike> {501 /**502 * Returns the value of the last element in the array where predicate is true, and undefined503 * otherwise.504 * @param predicate findLast calls predicate once for each element of the array, in descending505 * order, until it finds one where predicate returns true. If such an element is found, findLast506 * immediately returns that element value. Otherwise, findLast returns undefined.507 * @param thisArg If provided, it will be used as the this value for each invocation of508 * predicate. If it is not provided, undefined is used instead.509 */510 findLast<S extends number>(511 predicate: (512 value: number,513 index: number,514 array: this,515 ) => value is S,516 thisArg?: any,517 ): S | undefined;518 findLast(519 predicate: (value: number, index: number, array: this) => unknown,520 thisArg?: any,521 ): number | undefined;522 523 /**524 * Returns the index of the last element in the array where predicate is true, and -1525 * otherwise.526 * @param predicate findLastIndex calls predicate once for each element of the array, in descending527 * order, until it finds one where predicate returns true. If such an element is found,528 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.529 * @param thisArg If provided, it will be used as the this value for each invocation of530 * predicate. If it is not provided, undefined is used instead.531 */532 findLastIndex(533 predicate: (value: number, index: number, array: this) => unknown,534 thisArg?: any,535 ): number;536 537 /**538 * Copies the array and returns the copy with the elements in reverse order.539 */540 toReversed(): Int32Array<ArrayBuffer>;541 542 /**543 * Copies and sorts the array.544 * @param compareFn Function used to determine the order of the elements. It is expected to return545 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive546 * value otherwise. If omitted, the elements are sorted in ascending order.547 * ```ts548 * const myNums = Int32Array.from([11, 2, -22, 1]);549 * myNums.toSorted((a, b) => a - b) // Int32Array(4) [-22, 1, 2, 11]550 * ```551 */552 toSorted(compareFn?: (a: number, b: number) => number): Int32Array<ArrayBuffer>;553 554 /**555 * Copies the array and inserts the given number at the provided index.556 * @param index The index of the value to overwrite. If the index is557 * negative, then it replaces from the end of the array.558 * @param value The value to insert into the copied array.559 * @returns A copy of the original array with the inserted value.560 */561 with(index: number, value: number): Int32Array<ArrayBuffer>;562}563 564interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {565 /**566 * Returns the value of the last element in the array where predicate is true, and undefined567 * otherwise.568 * @param predicate findLast calls predicate once for each element of the array, in descending569 * order, until it finds one where predicate returns true. If such an element is found, findLast570 * immediately returns that element value. Otherwise, findLast returns undefined.571 * @param thisArg If provided, it will be used as the this value for each invocation of572 * predicate. If it is not provided, undefined is used instead.573 */574 findLast<S extends number>(575 predicate: (576 value: number,577 index: number,578 array: this,579 ) => value is S,580 thisArg?: any,581 ): S | undefined;582 findLast(583 predicate: (584 value: number,585 index: number,586 array: this,587 ) => unknown,588 thisArg?: any,589 ): number | undefined;590 591 /**592 * Returns the index of the last element in the array where predicate is true, and -1593 * otherwise.594 * @param predicate findLastIndex calls predicate once for each element of the array, in descending595 * order, until it finds one where predicate returns true. If such an element is found,596 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.597 * @param thisArg If provided, it will be used as the this value for each invocation of598 * predicate. If it is not provided, undefined is used instead.599 */600 findLastIndex(601 predicate: (602 value: number,603 index: number,604 array: this,605 ) => unknown,606 thisArg?: any,607 ): number;608 609 /**610 * Copies the array and returns the copy with the elements in reverse order.611 */612 toReversed(): Uint32Array<ArrayBuffer>;613 614 /**615 * Copies and sorts the array.616 * @param compareFn Function used to determine the order of the elements. It is expected to return617 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive618 * value otherwise. If omitted, the elements are sorted in ascending order.619 * ```ts620 * const myNums = Uint32Array.from([11, 2, 22, 1]);621 * myNums.toSorted((a, b) => a - b) // Uint32Array(4) [1, 2, 11, 22]622 * ```623 */624 toSorted(compareFn?: (a: number, b: number) => number): Uint32Array<ArrayBuffer>;625 626 /**627 * Copies the array and inserts the given number at the provided index.628 * @param index The index of the value to overwrite. If the index is629 * negative, then it replaces from the end of the array.630 * @param value The value to insert into the copied array.631 * @returns A copy of the original array with the inserted value.632 */633 with(index: number, value: number): Uint32Array<ArrayBuffer>;634}635 636interface Float32Array<TArrayBuffer extends ArrayBufferLike> {637 /**638 * Returns the value of the last element in the array where predicate is true, and undefined639 * otherwise.640 * @param predicate findLast calls predicate once for each element of the array, in descending641 * order, until it finds one where predicate returns true. If such an element is found, findLast642 * immediately returns that element value. Otherwise, findLast returns undefined.643 * @param thisArg If provided, it will be used as the this value for each invocation of644 * predicate. If it is not provided, undefined is used instead.645 */646 findLast<S extends number>(647 predicate: (648 value: number,649 index: number,650 array: this,651 ) => value is S,652 thisArg?: any,653 ): S | undefined;654 findLast(655 predicate: (656 value: number,657 index: number,658 array: this,659 ) => unknown,660 thisArg?: any,661 ): number | undefined;662 663 /**664 * Returns the index of the last element in the array where predicate is true, and -1665 * otherwise.666 * @param predicate findLastIndex calls predicate once for each element of the array, in descending667 * order, until it finds one where predicate returns true. If such an element is found,668 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.669 * @param thisArg If provided, it will be used as the this value for each invocation of670 * predicate. If it is not provided, undefined is used instead.671 */672 findLastIndex(673 predicate: (674 value: number,675 index: number,676 array: this,677 ) => unknown,678 thisArg?: any,679 ): number;680 681 /**682 * Copies the array and returns the copy with the elements in reverse order.683 */684 toReversed(): Float32Array<ArrayBuffer>;685 686 /**687 * Copies and sorts the array.688 * @param compareFn Function used to determine the order of the elements. It is expected to return689 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive690 * value otherwise. If omitted, the elements are sorted in ascending order.691 * ```ts692 * const myNums = Float32Array.from([11.25, 2, -22.5, 1]);693 * myNums.toSorted((a, b) => a - b) // Float32Array(4) [-22.5, 1, 2, 11.5]694 * ```695 */696 toSorted(compareFn?: (a: number, b: number) => number): Float32Array<ArrayBuffer>;697 698 /**699 * Copies the array and inserts the given number at the provided index.700 * @param index The index of the value to overwrite. If the index is701 * negative, then it replaces from the end of the array.702 * @param value The value to insert into the copied array.703 * @returns A copy of the original array with the inserted value.704 */705 with(index: number, value: number): Float32Array<ArrayBuffer>;706}707 708interface Float64Array<TArrayBuffer extends ArrayBufferLike> {709 /**710 * Returns the value of the last element in the array where predicate is true, and undefined711 * otherwise.712 * @param predicate findLast calls predicate once for each element of the array, in descending713 * order, until it finds one where predicate returns true. If such an element is found, findLast714 * immediately returns that element value. Otherwise, findLast returns undefined.715 * @param thisArg If provided, it will be used as the this value for each invocation of716 * predicate. If it is not provided, undefined is used instead.717 */718 findLast<S extends number>(719 predicate: (720 value: number,721 index: number,722 array: this,723 ) => value is S,724 thisArg?: any,725 ): S | undefined;726 findLast(727 predicate: (728 value: number,729 index: number,730 array: this,731 ) => unknown,732 thisArg?: any,733 ): number | undefined;734 735 /**736 * Returns the index of the last element in the array where predicate is true, and -1737 * otherwise.738 * @param predicate findLastIndex calls predicate once for each element of the array, in descending739 * order, until it finds one where predicate returns true. If such an element is found,740 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.741 * @param thisArg If provided, it will be used as the this value for each invocation of742 * predicate. If it is not provided, undefined is used instead.743 */744 findLastIndex(745 predicate: (746 value: number,747 index: number,748 array: this,749 ) => unknown,750 thisArg?: any,751 ): number;752 753 /**754 * Copies the array and returns the copy with the elements in reverse order.755 */756 toReversed(): Float64Array<ArrayBuffer>;757 758 /**759 * Copies and sorts the array.760 * @param compareFn Function used to determine the order of the elements. It is expected to return761 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive762 * value otherwise. If omitted, the elements are sorted in ascending order.763 * ```ts764 * const myNums = Float64Array.from([11.25, 2, -22.5, 1]);765 * myNums.toSorted((a, b) => a - b) // Float64Array(4) [-22.5, 1, 2, 11.5]766 * ```767 */768 toSorted(compareFn?: (a: number, b: number) => number): Float64Array<ArrayBuffer>;769 770 /**771 * Copies the array and inserts the given number at the provided index.772 * @param index The index of the value to overwrite. If the index is773 * negative, then it replaces from the end of the array.774 * @param value The value to insert into the copied array.775 * @returns A copy of the original array with the inserted value.776 */777 with(index: number, value: number): Float64Array<ArrayBuffer>;778}779 780interface BigInt64Array<TArrayBuffer extends ArrayBufferLike> {781 /**782 * Returns the value of the last element in the array where predicate is true, and undefined783 * otherwise.784 * @param predicate findLast calls predicate once for each element of the array, in descending785 * order, until it finds one where predicate returns true. If such an element is found, findLast786 * immediately returns that element value. Otherwise, findLast returns undefined.787 * @param thisArg If provided, it will be used as the this value for each invocation of788 * predicate. If it is not provided, undefined is used instead.789 */790 findLast<S extends bigint>(791 predicate: (792 value: bigint,793 index: number,794 array: this,795 ) => value is S,796 thisArg?: any,797 ): S | undefined;798 findLast(799 predicate: (800 value: bigint,801 index: number,802 array: this,803 ) => unknown,804 thisArg?: any,805 ): bigint | undefined;806 807 /**808 * Returns the index of the last element in the array where predicate is true, and -1809 * otherwise.810 * @param predicate findLastIndex calls predicate once for each element of the array, in descending811 * order, until it finds one where predicate returns true. If such an element is found,812 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.813 * @param thisArg If provided, it will be used as the this value for each invocation of814 * predicate. If it is not provided, undefined is used instead.815 */816 findLastIndex(817 predicate: (818 value: bigint,819 index: number,820 array: this,821 ) => unknown,822 thisArg?: any,823 ): number;824 825 /**826 * Copies the array and returns the copy with the elements in reverse order.827 */828 toReversed(): BigInt64Array<ArrayBuffer>;829 830 /**831 * Copies and sorts the array.832 * @param compareFn Function used to determine the order of the elements. It is expected to return833 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive834 * value otherwise. If omitted, the elements are sorted in ascending order.835 * ```ts836 * const myNums = BigInt64Array.from([11n, 2n, -22n, 1n]);837 * myNums.toSorted((a, b) => Number(a - b)) // BigInt64Array(4) [-22n, 1n, 2n, 11n]838 * ```839 */840 toSorted(compareFn?: (a: bigint, b: bigint) => number): BigInt64Array<ArrayBuffer>;841 842 /**843 * Copies the array and inserts the given bigint at the provided index.844 * @param index The index of the value to overwrite. If the index is845 * negative, then it replaces from the end of the array.846 * @param value The value to insert into the copied array.847 * @returns A copy of the original array with the inserted value.848 */849 with(index: number, value: bigint): BigInt64Array<ArrayBuffer>;850}851 852interface BigUint64Array<TArrayBuffer extends ArrayBufferLike> {853 /**854 * Returns the value of the last element in the array where predicate is true, and undefined855 * otherwise.856 * @param predicate findLast calls predicate once for each element of the array, in descending857 * order, until it finds one where predicate returns true. If such an element is found, findLast858 * immediately returns that element value. Otherwise, findLast returns undefined.859 * @param thisArg If provided, it will be used as the this value for each invocation of860 * predicate. If it is not provided, undefined is used instead.861 */862 findLast<S extends bigint>(863 predicate: (864 value: bigint,865 index: number,866 array: this,867 ) => value is S,868 thisArg?: any,869 ): S | undefined;870 findLast(871 predicate: (872 value: bigint,873 index: number,874 array: this,875 ) => unknown,876 thisArg?: any,877 ): bigint | undefined;878 879 /**880 * Returns the index of the last element in the array where predicate is true, and -1881 * otherwise.882 * @param predicate findLastIndex calls predicate once for each element of the array, in descending883 * order, until it finds one where predicate returns true. If such an element is found,884 * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.885 * @param thisArg If provided, it will be used as the this value for each invocation of886 * predicate. If it is not provided, undefined is used instead.887 */888 findLastIndex(889 predicate: (890 value: bigint,891 index: number,892 array: this,893 ) => unknown,894 thisArg?: any,895 ): number;896 897 /**898 * Copies the array and returns the copy with the elements in reverse order.899 */900 toReversed(): BigUint64Array<ArrayBuffer>;901 902 /**903 * Copies and sorts the array.904 * @param compareFn Function used to determine the order of the elements. It is expected to return905 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive906 * value otherwise. If omitted, the elements are sorted in ascending order.907 * ```ts908 * const myNums = BigUint64Array.from([11n, 2n, 22n, 1n]);909 * myNums.toSorted((a, b) => Number(a - b)) // BigUint64Array(4) [1n, 2n, 11n, 22n]910 * ```911 */912 toSorted(compareFn?: (a: bigint, b: bigint) => number): BigUint64Array<ArrayBuffer>;913 914 /**915 * Copies the array and inserts the given bigint at the provided index.916 * @param index The index of the value to overwrite. If the index is917 * negative, then it replaces from the end of the array.918 * @param value The value to insert into the copied array.919 * @returns A copy of the original array with the inserted value.920 */921 with(index: number, value: bigint): BigUint64Array<ArrayBuffer>;922}923 