1/*! ***************************************************************************** 2Copyright (c) Microsoft Corporation. All rights reserved. 3Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4this file except in compliance with the License. You may obtain a copy of the 5License at http://www.apache.org/licenses/LICENSE-2.0 6 7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 10MERCHANTABLITY OR NON-INFRINGEMENT. 11 12See the Apache Version 2.0 License for specific language governing permissions 13and limitations under the License. 14***************************************************************************** */ 15 16 17 18/// <reference no-default-lib="true"/> 19 20 21///////////////////////////// 22/// ECMAScript APIs 23///////////////////////////// 24 25declare var NaN: number; 26declare var Infinity: number; 27 28/** 29 * Evaluates JavaScript code and executes it. 30 * @param x A String value that contains valid JavaScript code. 31 */ 32declare function eval(x: string): any; 33 34/** 35 * Converts a string to an integer. 36 * @param string A string to convert into a number. 37 * @param radix A value between 2 and 36 that specifies the base of the number in `string`. 38 * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. 39 * All other strings are considered decimal. 40 */ 41declare function parseInt(string: string, radix?: number): number; 42 43/** 44 * Converts a string to a floating-point number. 45 * @param string A string that contains a floating-point number. 46 */ 47declare function parseFloat(string: string): number; 48 49/** 50 * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). 51 * @param number A numeric value. 52 */ 53declare function isNaN(number: number): boolean; 54 55/** 56 * Determines whether a supplied number is finite. 57 * @param number Any numeric value. 58 */ 59declare function isFinite(number: number): boolean; 60 61/** 62 * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). 63 * @param encodedURI A value representing an encoded URI. 64 */ 65declare function decodeURI(encodedURI: string): string; 66 67/** 68 * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). 69 * @param encodedURIComponent A value representing an encoded URI component. 70 */ 71declare function decodeURIComponent(encodedURIComponent: string): string; 72 73/** 74 * Encodes a text string as a valid Uniform Resource Identifier (URI) 75 * @param uri A value representing an unencoded URI. 76 */ 77declare function encodeURI(uri: string): string; 78 79/** 80 * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). 81 * @param uriComponent A value representing an unencoded URI component. 82 */ 83declare function encodeURIComponent(uriComponent: string | number | boolean): string; 84 85/** 86 * Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence. 87 * @deprecated A legacy feature for browser compatibility 88 * @param string A string value 89 */ 90declare function escape(string: string): string; 91 92/** 93 * Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents. 94 * @deprecated A legacy feature for browser compatibility 95 * @param string A string value 96 */ 97declare function unescape(string: string): string; 98 99interface Symbol { 100 /** Returns a string representation of an object. */ 101 toString(): string; 102 103 /** Returns the primitive value of the specified object. */ 104 valueOf(): symbol; 105} 106 107declare type PropertyKey = string | number | symbol; 108 109interface PropertyDescriptor { 110 configurable?: boolean; 111 enumerable?: boolean; 112 value?: any; 113 writable?: boolean; 114 get?(): any; 115 set?(v: any): void; 116} 117 118interface PropertyDescriptorMap { 119 [key: PropertyKey]: PropertyDescriptor; 120} 121 122interface Object { 123 /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ 124 constructor: Function; 125 126 /** Returns a string representation of an object. */ 127 toString(): string; 128 129 /** Returns a date converted to a string using the current locale. */ 130 toLocaleString(): string; 131 132 /** Returns the primitive value of the specified object. */ 133 valueOf(): Object; 134 135 /** 136 * Determines whether an object has a property with the specified name. 137 * @param v A property name. 138 */ 139 hasOwnProperty(v: PropertyKey): boolean; 140 141 /** 142 * Determines whether an object exists in another object's prototype chain. 143 * @param v Another object whose prototype chain is to be checked. 144 */ 145 isPrototypeOf(v: Object): boolean; 146 147 /** 148 * Determines whether a specified property is enumerable. 149 * @param v A property name. 150 */ 151 propertyIsEnumerable(v: PropertyKey): boolean; 152} 153 154interface ObjectConstructor { 155 new(value?: any): Object; 156 (): any; 157 (value: any): any; 158 159 /** A reference to the prototype for a class of objects. */ 160 readonly prototype: Object; 161 162 /** 163 * Returns the prototype of an object. 164 * @param o The object that references the prototype. 165 */ 166 getPrototypeOf(o: any): any; 167 168 /** 169 * Gets the own property descriptor of the specified object. 170 * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. 171 * @param o Object that contains the property. 172 * @param p Name of the property. 173 */ 174 getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; 175 176 /** 177 * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly 178 * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. 179 * @param o Object that contains the own properties. 180 */ 181 getOwnPropertyNames(o: any): string[]; 182 183 /** 184 * Creates an object that has the specified prototype or that has null prototype. 185 * @param o Object to use as a prototype. May be null. 186 */ 187 create(o: object | null): any; 188 189 /** 190 * Creates an object that has the specified prototype, and that optionally contains specified properties. 191 * @param o Object to use as a prototype. May be null 192 * @param properties JavaScript object that contains one or more property descriptors. 193 */ 194 create(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; 195 196 /** 197 * Adds a property to an object, or modifies attributes of an existing property. 198 * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. 199 * @param p The property name. 200 * @param attributes Descriptor for the property. It can be for a data property or an accessor property. 201 */ 202 defineProperty<T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): T; 203 204 /** 205 * Adds one or more properties to an object, and/or modifies attributes of existing properties. 206 * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. 207 * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. 208 */ 209 defineProperties<T>(o: T, properties: PropertyDescriptorMap & ThisType<any>): T; 210 211 /** 212 * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. 213 * @param o Object on which to lock the attributes. 214 */ 215 seal<T>(o: T): T; 216 217 /** 218 * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. 219 * @param f Object on which to lock the attributes. 220 */ 221 freeze<T extends Function>(f: T): T; 222 223 /** 224 * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. 225 * @param o Object on which to lock the attributes. 226 */ 227 freeze<T extends {[idx: string]: U | null | undefined | object}, U extends string | bigint | number | boolean | symbol>(o: T): Readonly<T>; 228 229 /** 230 * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. 231 * @param o Object on which to lock the attributes. 232 */ 233 freeze<T>(o: T): Readonly<T>; 234 235 /** 236 * Prevents the addition of new properties to an object. 237 * @param o Object to make non-extensible. 238 */ 239 preventExtensions<T>(o: T): T; 240 241 /** 242 * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. 243 * @param o Object to test. 244 */ 245 isSealed(o: any): boolean; 246 247 /** 248 * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. 249 * @param o Object to test. 250 */ 251 isFrozen(o: any): boolean; 252 253 /** 254 * Returns a value that indicates whether new properties can be added to an object. 255 * @param o Object to test. 256 */ 257 isExtensible(o: any): boolean; 258 259 /** 260 * Returns the names of the enumerable string properties and methods of an object. 261 * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. 262 */ 263 keys(o: object): string[]; 264} 265 266/** 267 * Provides functionality common to all JavaScript objects. 268 */ 269declare var Object: ObjectConstructor; 270 271/** 272 * Creates a new function. 273 */ 274interface Function { 275 /** 276 * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. 277 * @param thisArg The object to be used as the this object. 278 * @param argArray A set of arguments to be passed to the function. 279 */ 280 apply(this: Function, thisArg: any, argArray?: any): any; 281 282 /** 283 * Calls a method of an object, substituting another object for the current object. 284 * @param thisArg The object to be used as the current object. 285 * @param argArray A list of arguments to be passed to the method. 286 */ 287 call(this: Function, thisArg: any, ...argArray: any[]): any; 288 289 /** 290 * For a given function, creates a bound function that has the same body as the original function. 291 * The this object of the bound function is associated with the specified object, and has the specified initial parameters. 292 * @param thisArg An object to which the this keyword can refer inside the new function. 293 * @param argArray A list of arguments to be passed to the new function. 294 */ 295 bind(this: Function, thisArg: any, ...argArray: any[]): any; 296 297 /** Returns a string representation of a function. */ 298 toString(): string; 299 300 prototype: any; 301 readonly length: number; 302 303 // Non-standard extensions 304 arguments: any; 305 caller: Function; 306} 307 308interface FunctionConstructor { 309 /** 310 * Creates a new function. 311 * @param args A list of arguments the function accepts. 312 */ 313 new(...args: string[]): Function; 314 (...args: string[]): Function; 315 readonly prototype: Function; 316} 317 318declare var Function: FunctionConstructor; 319 320/** 321 * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. 322 */ 323type ThisParameterType<T> = T extends (this: infer U, ...args: never) => any ? U : unknown; 324 325/** 326 * Removes the 'this' parameter from a function type. 327 */ 328type OmitThisParameter<T> = unknown extends ThisParameterType<T> ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; 329 330interface CallableFunction extends Function { 331 /** 332 * Calls the function with the specified object as the this value and the elements of specified array as the arguments. 333 * @param thisArg The object to be used as the this object. 334 * @param args An array of argument values to be passed to the function. 335 */ 336 apply<T, R>(this: (this: T) => R, thisArg: T): R; 337 apply<T, A extends any[], R>(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; 338 339 /** 340 * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. 341 * @param thisArg The object to be used as the this object. 342 * @param args Argument values to be passed to the function. 343 */ 344 call<T, A extends any[], R>(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; 345 346 /** 347 * For a given function, creates a bound function that has the same body as the original function. 348 * The this object of the bound function is associated with the specified object, and has the specified initial parameters. 349 * @param thisArg The object to be used as the this object. 350 * @param args Arguments to bind to the parameters of the function. 351 */ 352 bind<T>(this: T, thisArg: ThisParameterType<T>): OmitThisParameter<T>; 353 bind<T, A0, A extends any[], R>(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; 354 bind<T, A0, A1, A extends any[], R>(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; 355 bind<T, A0, A1, A2, A extends any[], R>(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; 356 bind<T, A0, A1, A2, A3, A extends any[], R>(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; 357 bind<T, AX, R>(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; 358} 359 360interface NewableFunction extends Function { 361 /** 362 * Calls the function with the specified object as the this value and the elements of specified array as the arguments. 363 * @param thisArg The object to be used as the this object. 364 * @param args An array of argument values to be passed to the function. 365 */ 366 apply<T>(this: new () => T, thisArg: T): void; 367 apply<T, A extends any[]>(this: new (...args: A) => T, thisArg: T, args: A): void; 368 369 /** 370 * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. 371 * @param thisArg The object to be used as the this object. 372 * @param args Argument values to be passed to the function. 373 */ 374 call<T, A extends any[]>(this: new (...args: A) => T, thisArg: T, ...args: A): void; 375 376 /** 377 * For a given function, creates a bound function that has the same body as the original function. 378 * The this object of the bound function is associated with the specified object, and has the specified initial parameters. 379 * @param thisArg The object to be used as the this object. 380 * @param args Arguments to bind to the parameters of the function. 381 */ 382 bind<T>(this: T, thisArg: any): T; 383 bind<A0, A extends any[], R>(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; 384 bind<A0, A1, A extends any[], R>(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; 385 bind<A0, A1, A2, A extends any[], R>(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; 386 bind<A0, A1, A2, A3, A extends any[], R>(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; 387 bind<AX, R>(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; 388} 389 390interface IArguments { 391 [index: number]: any; 392 length: number; 393 callee: Function; 394} 395 396interface String { 397 /** Returns a string representation of a string. */ 398 toString(): string; 399 400 /** 401 * Returns the character at the specified index. 402 * @param pos The zero-based index of the desired character. 403 */ 404 charAt(pos: number): string; 405 406 /** 407 * Returns the Unicode value of the character at the specified location. 408 * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. 409 */ 410 charCodeAt(index: number): number; 411 412 /** 413 * Returns a string that contains the concatenation of two or more strings. 414 * @param strings The strings to append to the end of the string. 415 */ 416 concat(...strings: string[]): string; 417 418 /** 419 * Returns the position of the first occurrence of a substring. 420 * @param searchString The substring to search for in the string 421 * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. 422 */ 423 indexOf(searchString: string, position?: number): number; 424 425 /** 426 * Returns the last occurrence of a substring in the string. 427 * @param searchString The substring to search for. 428 * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. 429 */ 430 lastIndexOf(searchString: string, position?: number): number; 431 432 /** 433 * Determines whether two strings are equivalent in the current locale. 434 * @param that String to compare to target string 435 */ 436 localeCompare(that: string): number; 437 438 /** 439 * Matches a string with a regular expression, and returns an array containing the results of that search. 440 * @param regexp A variable name or string literal containing the regular expression pattern and flags. 441 */ 442 match(regexp: string | RegExp): RegExpMatchArray | null; 443 444 /** 445 * Replaces text in a string, using a regular expression or search string. 446 * @param searchValue A string or regular expression to search for. 447 * @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a `RegExp`, all matches are replaced if the `g` flag is set (or only those matches at the beginning, if the `y` flag is also present). Otherwise, only the first match of {@linkcode searchValue} is replaced. 448 */ 449 replace(searchValue: string | RegExp, replaceValue: string): string; 450 451 /** 452 * Replaces text in a string, using a regular expression or search string. 453 * @param searchValue A string to search for. 454 * @param replacer A function that returns the replacement text. 455 */ 456 replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; 457 458 /** 459 * Finds the first substring match in a regular expression search. 460 * @param regexp The regular expression pattern and applicable flags. 461 */ 462 search(regexp: string | RegExp): number; 463 464 /** 465 * Returns a section of a string. 466 * @param start The index to the beginning of the specified portion of stringObj. 467 * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. 468 * If this value is not specified, the substring continues to the end of stringObj. 469 */ 470 slice(start?: number, end?: number): string; 471 472 /** 473 * Split a string into substrings using the specified separator and return them as an array. 474 * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. 475 * @param limit A value used to limit the number of elements returned in the array. 476 */ 477 split(separator: string | RegExp, limit?: number): string[]; 478 479 /** 480 * Returns the substring at the specified location within a String object. 481 * @param start The zero-based index number indicating the beginning of the substring. 482 * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. 483 * If end is omitted, the characters from start through the end of the original string are returned. 484 */ 485 substring(start: number, end?: number): string; 486 487 /** Converts all the alphabetic characters in a string to lowercase. */ 488 toLowerCase(): string; 489 490 /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ 491 toLocaleLowerCase(locales?: string | string[]): string; 492 493 /** Converts all the alphabetic characters in a string to uppercase. */ 494 toUpperCase(): string; 495 496 /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ 497 toLocaleUpperCase(locales?: string | string[]): string; 498 499 /** Removes the leading and trailing white space and line terminator characters from a string. */ 500 trim(): string; 501 502 /** Returns the length of a String object. */ 503 readonly length: number; 504 505 // IE extensions 506 /** 507 * Gets a substring beginning at the specified location and having the specified length. 508 * @deprecated A legacy feature for browser compatibility 509 * @param from The starting position of the desired substring. The index of the first character in the string is zero. 510 * @param length The number of characters to include in the returned substring. 511 */ 512 substr(from: number, length?: number): string; 513 514 /** Returns the primitive value of the specified object. */ 515 valueOf(): string; 516 517 readonly [index: number]: string; 518} 519 520interface StringConstructor { 521 new(value?: any): String; 522 (value?: any): string; 523 readonly prototype: String; 524 fromCharCode(...codes: number[]): string; 525} 526 527/** 528 * Allows manipulation and formatting of text strings and determination and location of substrings within strings. 529 */ 530declare var String: StringConstructor; 531 532interface Boolean { 533 /** Returns the primitive value of the specified object. */ 534 valueOf(): boolean; 535} 536 537interface BooleanConstructor { 538 new(value?: any): Boolean; 539 <T>(value?: T): boolean; 540 readonly prototype: Boolean; 541} 542 543declare var Boolean: BooleanConstructor; 544 545interface Number { 546 /** 547 * Returns a string representation of an object. 548 * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. 549 */ 550 toString(radix?: number): string; 551 552 /** 553 * Returns a string representing a number in fixed-point notation. 554 * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. 555 */ 556 toFixed(fractionDigits?: number): string; 557 558 /** 559 * Returns a string containing a number represented in exponential notation. 560 * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. 561 */ 562 toExponential(fractionDigits?: number): string; 563 564 /** 565 * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. 566 * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. 567 */ 568 toPrecision(precision?: number): string; 569 570 /** Returns the primitive value of the specified object. */ 571 valueOf(): number; 572} 573 574interface NumberConstructor { 575 new(value?: any): Number; 576 (value?: any): number; 577 readonly prototype: Number; 578 579 /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ 580 readonly MAX_VALUE: number; 581 582 /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ 583 readonly MIN_VALUE: number; 584 585 /** 586 * A value that is not a number. 587 * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. 588 */ 589 readonly NaN: number; 590 591 /** 592 * A value that is less than the largest negative number that can be represented in JavaScript. 593 * JavaScript displays NEGATIVE_INFINITY values as -infinity. 594 */ 595 readonly NEGATIVE_INFINITY: number; 596 597 /** 598 * A value greater than the largest number that can be represented in JavaScript. 599 * JavaScript displays POSITIVE_INFINITY values as infinity. 600 */ 601 readonly POSITIVE_INFINITY: number; 602} 603 604/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ 605declare var Number: NumberConstructor; 606 607interface TemplateStringsArray extends ReadonlyArray<string> { 608 readonly raw: readonly string[]; 609} 610 611/** 612 * The type of `import.meta`. 613 * 614 * If you need to declare that a given property exists on `import.meta`, 615 * this type may be augmented via interface merging. 616 */ 617interface ImportMeta { 618} 619 620/** 621 * The type for the optional second argument to `import()`. 622 * 623 * If your host environment supports additional options, this type may be 624 * augmented via interface merging. 625 */ 626interface ImportCallOptions { 627 assert?: ImportAssertions; 628} 629 630/** 631 * The type for the `assert` property of the optional second argument to `import()`. 632 */ 633interface ImportAssertions { 634 [key: string]: string; 635} 636 637interface Math { 638 /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ 639 readonly E: number; 640 /** The natural logarithm of 10. */ 641 readonly LN10: number; 642 /** The natural logarithm of 2. */ 643 readonly LN2: number; 644 /** The base-2 logarithm of e. */ 645 readonly LOG2E: number; 646 /** The base-10 logarithm of e. */ 647 readonly LOG10E: number; 648 /** Pi. This is the ratio of the circumference of a circle to its diameter. */ 649 readonly PI: number; 650 /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ 651 readonly SQRT1_2: number; 652 /** The square root of 2. */ 653 readonly SQRT2: number; 654 /** 655 * Returns the absolute value of a number (the value without regard to whether it is positive or negative). 656 * For example, the absolute value of -5 is the same as the absolute value of 5. 657 * @param x A numeric expression for which the absolute value is needed. 658 */ 659 abs(x: number): number; 660 /** 661 * Returns the arc cosine (or inverse cosine) of a number. 662 * @param x A numeric expression. 663 */ 664 acos(x: number): number; 665 /** 666 * Returns the arcsine of a number. 667 * @param x A numeric expression. 668 */ 669 asin(x: number): number; 670 /** 671 * Returns the arctangent of a number. 672 * @param x A numeric expression for which the arctangent is needed. 673 */ 674 atan(x: number): number; 675 /** 676 * Returns the angle (in radians) from the X axis to a point. 677 * @param y A numeric expression representing the cartesian y-coordinate. 678 * @param x A numeric expression representing the cartesian x-coordinate. 679 */ 680 atan2(y: number, x: number): number; 681 /** 682 * Returns the smallest integer greater than or equal to its numeric argument. 683 * @param x A numeric expression. 684 */ 685 ceil(x: number): number; 686 /** 687 * Returns the cosine of a number. 688 * @param x A numeric expression that contains an angle measured in radians. 689 */ 690 cos(x: number): number; 691 /** 692 * Returns e (the base of natural logarithms) raised to a power. 693 * @param x A numeric expression representing the power of e. 694 */ 695 exp(x: number): number; 696 /** 697 * Returns the greatest integer less than or equal to its numeric argument. 698 * @param x A numeric expression. 699 */ 700 floor(x: number): number; 701 /** 702 * Returns the natural logarithm (base e) of a number. 703 * @param x A numeric expression. 704 */ 705 log(x: number): number; 706 /** 707 * Returns the larger of a set of supplied numeric expressions. 708 * @param values Numeric expressions to be evaluated. 709 */ 710 max(...values: number[]): number; 711 /** 712 * Returns the smaller of a set of supplied numeric expressions. 713 * @param values Numeric expressions to be evaluated. 714 */ 715 min(...values: number[]): number; 716 /** 717 * Returns the value of a base expression taken to a specified power. 718 * @param x The base value of the expression. 719 * @param y The exponent value of the expression. 720 */ 721 pow(x: number, y: number): number; 722 /** Returns a pseudorandom number between 0 and 1. */ 723 random(): number; 724 /** 725 * Returns a supplied numeric expression rounded to the nearest integer. 726 * @param x The value to be rounded to the nearest integer. 727 */ 728 round(x: number): number; 729 /** 730 * Returns the sine of a number. 731 * @param x A numeric expression that contains an angle measured in radians. 732 */ 733 sin(x: number): number; 734 /** 735 * Returns the square root of a number. 736 * @param x A numeric expression. 737 */ 738 sqrt(x: number): number; 739 /** 740 * Returns the tangent of a number. 741 * @param x A numeric expression that contains an angle measured in radians. 742 */ 743 tan(x: number): number; 744} 745/** An intrinsic object that provides basic mathematics functionality and constants. */ 746declare var Math: Math; 747 748/** Enables basic storage and retrieval of dates and times. */ 749interface Date { 750 /** Returns a string representation of a date. The format of the string depends on the locale. */ 751 toString(): string; 752 /** Returns a date as a string value. */ 753 toDateString(): string; 754 /** Returns a time as a string value. */ 755 toTimeString(): string; 756 /** Returns a value as a string value appropriate to the host environment's current locale. */ 757 toLocaleString(): string; 758 /** Returns a date as a string value appropriate to the host environment's current locale. */ 759 toLocaleDateString(): string; 760 /** Returns a time as a string value appropriate to the host environment's current locale. */ 761 toLocaleTimeString(): string; 762 /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ 763 valueOf(): number; 764 /** Gets the time value in milliseconds. */ 765 getTime(): number; 766 /** Gets the year, using local time. */ 767 getFullYear(): number; 768 /** Gets the year using Universal Coordinated Time (UTC). */ 769 getUTCFullYear(): number; 770 /** Gets the month, using local time. */ 771 getMonth(): number; 772 /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ 773 getUTCMonth(): number; 774 /** Gets the day-of-the-month, using local time. */ 775 getDate(): number; 776 /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ 777 getUTCDate(): number; 778 /** Gets the day of the week, using local time. */ 779 getDay(): number; 780 /** Gets the day of the week using Universal Coordinated Time (UTC). */ 781 getUTCDay(): number; 782 /** Gets the hours in a date, using local time. */ 783 getHours(): number; 784 /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ 785 getUTCHours(): number; 786 /** Gets the minutes of a Date object, using local time. */ 787 getMinutes(): number; 788 /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ 789 getUTCMinutes(): number; 790 /** Gets the seconds of a Date object, using local time. */ 791 getSeconds(): number; 792 /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ 793 getUTCSeconds(): number; 794 /** Gets the milliseconds of a Date, using local time. */ 795 getMilliseconds(): number; 796 /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ 797 getUTCMilliseconds(): number; 798 /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ 799 getTimezoneOffset(): number; 800 /** 801 * Sets the date and time value in the Date object. 802 * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. 803 */ 804 setTime(time: number): number; 805 /** 806 * Sets the milliseconds value in the Date object using local time. 807 * @param ms A numeric value equal to the millisecond value. 808 */ 809 setMilliseconds(ms: number): number; 810 /** 811 * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). 812 * @param ms A numeric value equal to the millisecond value. 813 */ 814 setUTCMilliseconds(ms: number): number; 815 816 /** 817 * Sets the seconds value in the Date object using local time. 818 * @param sec A numeric value equal to the seconds value. 819 * @param ms A numeric value equal to the milliseconds value. 820 */ 821 setSeconds(sec: number, ms?: number): number; 822 /** 823 * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). 824 * @param sec A numeric value equal to the seconds value. 825 * @param ms A numeric value equal to the milliseconds value. 826 */ 827 setUTCSeconds(sec: number, ms?: number): number; 828 /** 829 * Sets the minutes value in the Date object using local time. 830 * @param min A numeric value equal to the minutes value. 831 * @param sec A numeric value equal to the seconds value. 832 * @param ms A numeric value equal to the milliseconds value. 833 */ 834 setMinutes(min: number, sec?: number, ms?: number): number; 835 /** 836 * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). 837 * @param min A numeric value equal to the minutes value. 838 * @param sec A numeric value equal to the seconds value. 839 * @param ms A numeric value equal to the milliseconds value. 840 */ 841 setUTCMinutes(min: number, sec?: number, ms?: number): number; 842 /** 843 * Sets the hour value in the Date object using local time. 844 * @param hours A numeric value equal to the hours value. 845 * @param min A numeric value equal to the minutes value. 846 * @param sec A numeric value equal to the seconds value. 847 * @param ms A numeric value equal to the milliseconds value. 848 */ 849 setHours(hours: number, min?: number, sec?: number, ms?: number): number; 850 /** 851 * Sets the hours value in the Date object using Universal Coordinated Time (UTC). 852 * @param hours A numeric value equal to the hours value. 853 * @param min A numeric value equal to the minutes value. 854 * @param sec A numeric value equal to the seconds value. 855 * @param ms A numeric value equal to the milliseconds value. 856 */ 857 setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; 858 /** 859 * Sets the numeric day-of-the-month value of the Date object using local time. 860 * @param date A numeric value equal to the day of the month. 861 */ 862 setDate(date: number): number; 863 /** 864 * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). 865 * @param date A numeric value equal to the day of the month. 866 */ 867 setUTCDate(date: number): number; 868 /** 869 * Sets the month value in the Date object using local time. 870 * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. 871 * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. 872 */ 873 setMonth(month: number, date?: number): number; 874 /** 875 * Sets the month value in the Date object using Universal Coordinated Time (UTC). 876 * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. 877 * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. 878 */ 879 setUTCMonth(month: number, date?: number): number; 880 /** 881 * Sets the year of the Date object using local time. 882 * @param year A numeric value for the year. 883 * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. 884 * @param date A numeric value equal for the day of the month. 885 */ 886 setFullYear(year: number, month?: number, date?: number): number; 887 /** 888 * Sets the year value in the Date object using Universal Coordinated Time (UTC). 889 * @param year A numeric value equal to the year. 890 * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. 891 * @param date A numeric value equal to the day of the month. 892 */ 893 setUTCFullYear(year: number, month?: number, date?: number): number; 894 /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ 895 toUTCString(): string; 896 /** Returns a date as a string value in ISO format. */ 897 toISOString(): string; 898 /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ 899 toJSON(key?: any): string; 900} 901 902interface DateConstructor { 903 new(): Date; 904 new(value: number | string): Date; 905 /** 906 * Creates a new Date. 907 * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. 908 * @param monthIndex The month as a number between 0 and 11 (January to December). 909 * @param date The date as a number between 1 and 31. 910 * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. 911 * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. 912 * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. 913 * @param ms A number from 0 to 999 that specifies the milliseconds. 914 */ 915 new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; 916 (): string; 917 readonly prototype: Date; 918 /** 919 * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. 920 * @param s A date string 921 */ 922 parse(s: string): number; 923 /** 924 * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. 925 * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. 926 * @param monthIndex The month as a number between 0 and 11 (January to December). 927 * @param date The date as a number between 1 and 31. 928 * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. 929 * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. 930 * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. 931 * @param ms A number from 0 to 999 that specifies the milliseconds. 932 */ 933 UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; 934 /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC). */ 935 now(): number; 936} 937 938declare var Date: DateConstructor; 939 940interface RegExpMatchArray extends Array<string> { 941 /** 942 * The index of the search at which the result was found. 943 */ 944 index?: number; 945 /** 946 * A copy of the search string. 947 */ 948 input?: string; 949 /** 950 * The first match. This will always be present because `null` will be returned if there are no matches. 951 */ 952 0: string; 953} 954 955interface RegExpExecArray extends Array<string> { 956 /** 957 * The index of the search at which the result was found. 958 */ 959 index: number; 960 /** 961 * A copy of the search string. 962 */ 963 input: string; 964 /** 965 * The first match. This will always be present because `null` will be returned if there are no matches. 966 */ 967 0: string; 968} 969 970interface RegExp { 971 /** 972 * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. 973 * @param string The String object or string literal on which to perform the search. 974 */ 975 exec(string: string): RegExpExecArray | null; 976 977 /** 978 * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. 979 * @param string String on which to perform the search. 980 */ 981 test(string: string): boolean; 982 983 /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ 984 readonly source: string; 985 986 /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ 987 readonly global: boolean; 988 989 /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ 990 readonly ignoreCase: boolean; 991 992 /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ 993 readonly multiline: boolean; 994 995 lastIndex: number; 996 997 // Non-standard extensions 998 /** @deprecated A legacy feature for browser compatibility */ 999 compile(pattern: string, flags?: string): this; 1000} 1001 1002interface RegExpConstructor { 1003 new(pattern: RegExp | string): RegExp; 1004 new(pattern: string, flags?: string): RegExp; 1005 (pattern: RegExp | string): RegExp; 1006 (pattern: string, flags?: string): RegExp; 1007 readonly prototype: RegExp; 1008 1009 // Non-standard extensions 1010 /** @deprecated A legacy feature for browser compatibility */ 1011 $1: string; 1012 /** @deprecated A legacy feature for browser compatibility */ 1013 $2: string; 1014 /** @deprecated A legacy feature for browser compatibility */ 1015 $3: string; 1016 /** @deprecated A legacy feature for browser compatibility */ 1017 $4: string; 1018 /** @deprecated A legacy feature for browser compatibility */ 1019 $5: string; 1020 /** @deprecated A legacy feature for browser compatibility */ 1021 $6: string; 1022 /** @deprecated A legacy feature for browser compatibility */ 1023 $7: string; 1024 /** @deprecated A legacy feature for browser compatibility */ 1025 $8: string; 1026 /** @deprecated A legacy feature for browser compatibility */ 1027 $9: string; 1028 /** @deprecated A legacy feature for browser compatibility */ 1029 input: string; 1030 /** @deprecated A legacy feature for browser compatibility */ 1031 $_: string; 1032 /** @deprecated A legacy feature for browser compatibility */ 1033 lastMatch: string; 1034 /** @deprecated A legacy feature for browser compatibility */ 1035 "$&": string; 1036 /** @deprecated A legacy feature for browser compatibility */ 1037 lastParen: string; 1038 /** @deprecated A legacy feature for browser compatibility */ 1039 "$+": string; 1040 /** @deprecated A legacy feature for browser compatibility */ 1041 leftContext: string; 1042 /** @deprecated A legacy feature for browser compatibility */ 1043 "$`": string; 1044 /** @deprecated A legacy feature for browser compatibility */ 1045 rightContext: string; 1046 /** @deprecated A legacy feature for browser compatibility */ 1047 "$'": string; 1048} 1049 1050declare var RegExp: RegExpConstructor; 1051 1052interface Error { 1053 name: string; 1054 message: string; 1055 stack?: string; 1056} 1057 1058interface ErrorConstructor { 1059 new(message?: string): Error; 1060 (message?: string): Error; 1061 readonly prototype: Error; 1062} 1063 1064declare var Error: ErrorConstructor; 1065 1066interface EvalError extends Error { 1067} 1068 1069interface EvalErrorConstructor extends ErrorConstructor { 1070 new(message?: string): EvalError; 1071 (message?: string): EvalError; 1072 readonly prototype: EvalError; 1073} 1074 1075declare var EvalError: EvalErrorConstructor; 1076 1077interface RangeError extends Error { 1078} 1079 1080interface RangeErrorConstructor extends ErrorConstructor { 1081 new(message?: string): RangeError; 1082 (message?: string): RangeError; 1083 readonly prototype: RangeError; 1084} 1085 1086declare var RangeError: RangeErrorConstructor; 1087 1088interface ReferenceError extends Error { 1089} 1090 1091interface ReferenceErrorConstructor extends ErrorConstructor { 1092 new(message?: string): ReferenceError; 1093 (message?: string): ReferenceError; 1094 readonly prototype: ReferenceError; 1095} 1096 1097declare var ReferenceError: ReferenceErrorConstructor; 1098 1099interface SyntaxError extends Error { 1100} 1101 1102interface SyntaxErrorConstructor extends ErrorConstructor { 1103 new(message?: string): SyntaxError; 1104 (message?: string): SyntaxError; 1105 readonly prototype: SyntaxError; 1106} 1107 1108declare var SyntaxError: SyntaxErrorConstructor; 1109 1110interface TypeError extends Error { 1111} 1112 1113interface TypeErrorConstructor extends ErrorConstructor { 1114 new(message?: string): TypeError; 1115 (message?: string): TypeError; 1116 readonly prototype: TypeError; 1117} 1118 1119declare var TypeError: TypeErrorConstructor; 1120 1121interface URIError extends Error { 1122} 1123 1124interface URIErrorConstructor extends ErrorConstructor { 1125 new(message?: string): URIError; 1126 (message?: string): URIError; 1127 readonly prototype: URIError; 1128} 1129 1130declare var URIError: URIErrorConstructor; 1131 1132interface JSON { 1133 /** 1134 * Converts a JavaScript Object Notation (JSON) string into an object. 1135 * @param text A valid JSON string. 1136 * @param reviver A function that transforms the results. This function is called for each member of the object. 1137 * If a member contains nested objects, the nested objects are transformed before the parent object is. 1138 */ 1139 parse(text: string, reviver?: (this: any, key: string, value: any) => any): any; 1140 /** 1141 * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. 1142 * @param value A JavaScript value, usually an object or array, to be converted. 1143 * @param replacer A function that transforms the results. 1144 * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. 1145 */ 1146 stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; 1147 /** 1148 * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. 1149 * @param value A JavaScript value, usually an object or array, to be converted. 1150 * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. 1151 * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. 1152 */ 1153 stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; 1154} 1155 1156/** 1157 * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. 1158 */ 1159declare var JSON: JSON; 1160 1161 1162///////////////////////////// 1163/// ECMAScript Array API (specially handled by compiler) 1164///////////////////////////// 1165 1166interface ReadonlyArray<T> { 1167 /** 1168 * Gets the length of the array. This is a number one higher than the highest element defined in an array. 1169 */ 1170 readonly length: number; 1171 /** 1172 * Returns a string representation of an array. 1173 */ 1174 toString(): string; 1175 /** 1176 * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. 1177 */ 1178 toLocaleString(): string; 1179 /** 1180 * Combines two or more arrays. 1181 * @param items Additional items to add to the end of array1. 1182 */ 1183 concat(...items: ConcatArray<T>[]): T[]; 1184 /** 1185 * Combines two or more arrays. 1186 * @param items Additional items to add to the end of array1. 1187 */ 1188 concat(...items: (T | ConcatArray<T>)[]): T[]; 1189 /** 1190 * Adds all the elements of an array separated by the specified separator string. 1191 * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. 1192 */ 1193 join(separator?: string): string; 1194 /** 1195 * Returns a section of an array. 1196 * @param start The beginning of the specified portion of the array. 1197 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 1198 */ 1199 slice(start?: number, end?: number): T[]; 1200 /** 1201 * Returns the index of the first occurrence of a value in an array. 1202 * @param searchElement The value to locate in the array. 1203 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. 1204 */ 1205 indexOf(searchElement: T, fromIndex?: number): number; 1206 /** 1207 * Returns the index of the last occurrence of a specified value in an array. 1208 * @param searchElement The value to locate in the array. 1209 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. 1210 */ 1211 lastIndexOf(searchElement: T, fromIndex?: number): number; 1212 /** 1213 * Determines whether all the members of an array satisfy the specified test. 1214 * @param predicate A function that accepts up to three arguments. The every method calls 1215 * the predicate function for each element in the array until the predicate returns a value 1216 * which is coercible to the Boolean value false, or until the end of the array. 1217 * @param thisArg An object to which the this keyword can refer in the predicate function. 1218 * If thisArg is omitted, undefined is used as the this value. 1219 */ 1220 every<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[]; 1221 /** 1222 * Determines whether all the members of an array satisfy the specified test. 1223 * @param predicate A function that accepts up to three arguments. The every method calls 1224 * the predicate function for each element in the array until the predicate returns a value 1225 * which is coercible to the Boolean value false, or until the end of the array. 1226 * @param thisArg An object to which the this keyword can refer in the predicate function. 1227 * If thisArg is omitted, undefined is used as the this value. 1228 */ 1229 every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; 1230 /** 1231 * Determines whether the specified callback function returns true for any element of an array. 1232 * @param predicate A function that accepts up to three arguments. The some method calls 1233 * the predicate function for each element in the array until the predicate returns a value 1234 * which is coercible to the Boolean value true, or until the end of the array. 1235 * @param thisArg An object to which the this keyword can refer in the predicate function. 1236 * If thisArg is omitted, undefined is used as the this value. 1237 */ 1238 some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; 1239 /** 1240 * Performs the specified action for each element in an array. 1241 * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. 1242 * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. 1243 */ 1244 forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void; 1245 /** 1246 * Calls a defined callback function on each element of an array, and returns an array that contains the results. 1247 * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. 1248 * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. 1249 */ 1250 map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[]; 1251 /** 1252 * Returns the elements of an array that meet the condition specified in a callback function. 1253 * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. 1254 * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. 1255 */ 1256 filter<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[]; 1257 /** 1258 * Returns the elements of an array that meet the condition specified in a callback function. 1259 * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. 1260 * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. 1261 */ 1262 filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[]; 1263 /** 1264 * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. 1265 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. 1266 * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. 1267 */ 1268 reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; 1269 reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; 1270 /** 1271 * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. 1272 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. 1273 * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. 1274 */ 1275 reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; 1276 /** 1277 * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. 1278 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. 1279 * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. 1280 */ 1281 reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; 1282 reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; 1283 /** 1284 * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. 1285 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. 1286 * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. 1287 */ 1288 reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; 1289 1290 readonly [n: number]: T; 1291} 1292 1293interface ConcatArray<T> { 1294 readonly length: number; 1295 readonly [n: number]: T; 1296 join(separator?: string): string; 1297 slice(start?: number, end?: number): T[]; 1298} 1299 1300interface Array<T> { 1301 /** 1302 * Gets or sets the length of the array. This is a number one higher than the highest index in the array. 1303 */ 1304 length: number; 1305 /** 1306 * Returns a string representation of an array. 1307 */ 1308 toString(): string; 1309 /** 1310 * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. 1311 */ 1312 toLocaleString(): string; 1313 /** 1314 * Removes the last element from an array and returns it. 1315 * If the array is empty, undefined is returned and the array is not modified. 1316 */ 1317 pop(): T | undefined; 1318 /** 1319 * Appends new elements to the end of an array, and returns the new length of the array. 1320 * @param items New elements to add to the array. 1321 */ 1322 push(...items: T[]): number; 1323 /** 1324 * Combines two or more arrays. 1325 * This method returns a new array without modifying any existing arrays. 1326 * @param items Additional arrays and/or items to add to the end of the array. 1327 */ 1328 concat(...items: ConcatArray<T>[]): T[]; 1329 /** 1330 * Combines two or more arrays. 1331 * This method returns a new array without modifying any existing arrays. 1332 * @param items Additional arrays and/or items to add to the end of the array. 1333 */ 1334 concat(...items: (T | ConcatArray<T>)[]): T[]; 1335 /** 1336 * Adds all the elements of an array into a string, separated by the specified separator string. 1337 * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. 1338 */ 1339 join(separator?: string): string; 1340 /** 1341 * Reverses the elements in an array in place. 1342 * This method mutates the array and returns a reference to the same array. 1343 */ 1344 reverse(): T[]; 1345 /** 1346 * Removes the first element from an array and returns it. 1347 * If the array is empty, undefined is returned and the array is not modified. 1348 */ 1349 shift(): T | undefined; 1350 /** 1351 * Returns a copy of a section of an array. 1352 * For both start and end, a negative index can be used to indicate an offset from the end of the array. 1353 * For example, -2 refers to the second to last element of the array. 1354 * @param start The beginning index of the specified portion of the array. 1355 * If start is undefined, then the slice begins at index 0. 1356 * @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. 1357 * If end is undefined, then the slice extends to the end of the array. 1358 */ 1359 slice(start?: number, end?: number): T[]; 1360 /** 1361 * Sorts an array in place. 1362 * This method mutates the array and returns a reference to the same array. 1363 * @param compareFn Function used to determine the order of the elements. It is expected to return 1364 * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive 1365 * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. 1366 * ```ts 1367 * [11,2,22,1].sort((a, b) => a - b) 1368 * ``` 1369 */ 1370 sort(compareFn?: (a: T, b: T) => number): this; 1371 /** 1372 * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. 1373 * @param start The zero-based location in the array from which to start removing elements. 1374 * @param deleteCount The number of elements to remove. 1375 * @returns An array containing the elements that were deleted. 1376 */ 1377 splice(start: number, deleteCount?: number): T[]; 1378 /** 1379 * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. 1380 * @param start The zero-based location in the array from which to start removing elements. 1381 * @param deleteCount The number of elements to remove. 1382 * @param items Elements to insert into the array in place of the deleted elements. 1383 * @returns An array containing the elements that were deleted. 1384 */ 1385 splice(start: number, deleteCount: number, ...items: T[]): T[]; 1386 /** 1387 * Inserts new elements at the start of an array, and returns the new length of the array. 1388 * @param items Elements to insert at the start of the array. 1389 */ 1390 unshift(...items: T[]): number; 1391 /** 1392 * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. 1393 * @param searchElement The value to locate in the array. 1394 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. 1395 */ 1396 indexOf(searchElement: T, fromIndex?: number): number; 1397 /** 1398 * Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. 1399 * @param searchElement The value to locate in the array. 1400 * @param fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. 1401 */ 1402 lastIndexOf(searchElement: T, fromIndex?: number): number; 1403 /** 1404 * Determines whether all the members of an array satisfy the specified test. 1405 * @param predicate A function that accepts up to three arguments. The every method calls 1406 * the predicate function for each element in the array until the predicate returns a value 1407 * which is coercible to the Boolean value false, or until the end of the array. 1408 * @param thisArg An object to which the this keyword can refer in the predicate function. 1409 * If thisArg is omitted, undefined is used as the this value. 1410 */ 1411 every<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; 1412 /** 1413 * Determines whether all the members of an array satisfy the specified test. 1414 * @param predicate A function that accepts up to three arguments. The every method calls 1415 * the predicate function for each element in the array until the predicate returns a value 1416 * which is coercible to the Boolean value false, or until the end of the array. 1417 * @param thisArg An object to which the this keyword can refer in the predicate function. 1418 * If thisArg is omitted, undefined is used as the this value. 1419 */ 1420 every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; 1421 /** 1422 * Determines whether the specified callback function returns true for any element of an array. 1423 * @param predicate A function that accepts up to three arguments. The some method calls 1424 * the predicate function for each element in the array until the predicate returns a value 1425 * which is coercible to the Boolean value true, or until the end of the array. 1426 * @param thisArg An object to which the this keyword can refer in the predicate function. 1427 * If thisArg is omitted, undefined is used as the this value. 1428 */ 1429 some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; 1430 /** 1431 * Performs the specified action for each element in an array. 1432 * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. 1433 * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. 1434 */ 1435 forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; 1436 /** 1437 * Calls a defined callback function on each element of an array, and returns an array that contains the results. 1438 * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. 1439 * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. 1440 */ 1441 map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; 1442 /** 1443 * Returns the elements of an array that meet the condition specified in a callback function. 1444 * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. 1445 * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. 1446 */ 1447 filter<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; 1448 /** 1449 * Returns the elements of an array that meet the condition specified in a callback function. 1450 * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. 1451 * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. 1452 */ 1453 filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; 1454 /** 1455 * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. 1456 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. 1457 * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. 1458 */ 1459 reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; 1460 reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; 1461 /** 1462 * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. 1463 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. 1464 * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. 1465 */ 1466 reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; 1467 /** 1468 * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. 1469 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. 1470 * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. 1471 */ 1472 reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; 1473 reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; 1474 /** 1475 * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. 1476 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. 1477 * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. 1478 */ 1479 reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; 1480 1481 [n: number]: T; 1482} 1483 1484interface ArrayConstructor { 1485 new(arrayLength?: number): any[]; 1486 new <T>(arrayLength: number): T[]; 1487 new <T>(...items: T[]): T[]; 1488 (arrayLength?: number): any[]; 1489 <T>(arrayLength: number): T[]; 1490 <T>(...items: T[]): T[]; 1491 isArray(arg: any): arg is any[]; 1492 readonly prototype: any[]; 1493} 1494 1495declare var Array: ArrayConstructor; 1496 1497interface TypedPropertyDescriptor<T> { 1498 enumerable?: boolean; 1499 configurable?: boolean; 1500 writable?: boolean; 1501 value?: T; 1502 get?: () => T; 1503 set?: (value: T) => void; 1504} 1505 1506declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void; 1507declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; 1508declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void; 1509declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; 1510 1511declare type PromiseConstructorLike = new <T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) => PromiseLike<T>; 1512 1513interface PromiseLike<T> { 1514 /** 1515 * Attaches callbacks for the resolution and/or rejection of the Promise. 1516 * @param onfulfilled The callback to execute when the Promise is resolved. 1517 * @param onrejected The callback to execute when the Promise is rejected. 1518 * @returns A Promise for the completion of which ever callback is executed. 1519 */ 1520 then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>; 1521} 1522 1523/** 1524 * Represents the completion of an asynchronous operation 1525 */ 1526interface Promise<T> { 1527 /** 1528 * Attaches callbacks for the resolution and/or rejection of the Promise. 1529 * @param onfulfilled The callback to execute when the Promise is resolved. 1530 * @param onrejected The callback to execute when the Promise is rejected. 1531 * @returns A Promise for the completion of which ever callback is executed. 1532 */ 1533 then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>; 1534 1535 /** 1536 * Attaches a callback for only the rejection of the Promise. 1537 * @param onrejected The callback to execute when the Promise is rejected. 1538 * @returns A Promise for the completion of the callback. 1539 */ 1540 catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>; 1541} 1542 1543/** 1544 * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`. 1545 */ 1546type Awaited<T> = 1547 T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode 1548 T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped 1549 F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument 1550 Awaited<V> : // recursively unwrap the value 1551 never : // the argument to `then` was not callable 1552 T; // non-object or non-thenable 1553 1554interface ArrayLike<T> { 1555 readonly length: number; 1556 readonly [n: number]: T; 1557} 1558 1559/** 1560 * Make all properties in T optional 1561 */ 1562type Partial<T> = { 1563 [P in keyof T]?: T[P]; 1564}; 1565 1566/** 1567 * Make all properties in T required 1568 */ 1569type Required<T> = { 1570 [P in keyof T]-?: T[P]; 1571}; 1572 1573/** 1574 * Make all properties in T readonly 1575 */ 1576type Readonly<T> = { 1577 readonly [P in keyof T]: T[P]; 1578}; 1579 1580/** 1581 * From T, pick a set of properties whose keys are in the union K 1582 */ 1583type Pick<T, K extends keyof T> = { 1584 [P in K]: T[P]; 1585}; 1586 1587/** 1588 * Construct a type with a set of properties K of type T 1589 */ 1590type Record<K extends keyof any, T> = { 1591 [P in K]: T; 1592}; 1593 1594/** 1595 * Exclude from T those types that are assignable to U 1596 */ 1597type Exclude<T, U> = T extends U ? never : T; 1598 1599/** 1600 * Extract from T those types that are assignable to U 1601 */ 1602type Extract<T, U> = T extends U ? T : never; 1603 1604/** 1605 * Construct a type with the properties of T except for those in type K. 1606 */ 1607type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>; 1608 1609/** 1610 * Exclude null and undefined from T 1611 */ 1612type NonNullable<T> = T & {}; 1613 1614/** 1615 * Obtain the parameters of a function type in a tuple 1616 */ 1617type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never; 1618 1619/** 1620 * Obtain the parameters of a constructor function type in a tuple 1621 */ 1622type ConstructorParameters<T extends abstract new (...args: any) => any> = T extends abstract new (...args: infer P) => any ? P : never; 1623 1624/** 1625 * Obtain the return type of a function type 1626 */ 1627type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any; 1628 1629/** 1630 * Obtain the return type of a constructor function type 1631 */ 1632type InstanceType<T extends abstract new (...args: any) => any> = T extends abstract new (...args: any) => infer R ? R : any; 1633 1634/** 1635 * Convert string literal type to uppercase 1636 */ 1637type Uppercase<S extends string> = intrinsic; 1638 1639/** 1640 * Convert string literal type to lowercase 1641 */ 1642type Lowercase<S extends string> = intrinsic; 1643 1644/** 1645 * Convert first character of string literal type to uppercase 1646 */ 1647type Capitalize<S extends string> = intrinsic; 1648 1649/** 1650 * Convert first character of string literal type to lowercase 1651 */ 1652type Uncapitalize<S extends string> = intrinsic; 1653 1654/** 1655 * Marker for contextual 'this' type 1656 */ 1657interface ThisType<T> { } 1658 1659/** 1660 * Represents a raw buffer of binary data, which is used to store data for the 1661 * different typed arrays. ArrayBuffers cannot be read from or written to directly, 1662 * but can be passed to a typed array or DataView Object to interpret the raw 1663 * buffer as needed. 1664 */ 1665interface ArrayBuffer { 1666 /** 1667 * Read-only. The length of the ArrayBuffer (in bytes). 1668 */ 1669 readonly byteLength: number; 1670 1671 /** 1672 * Returns a section of an ArrayBuffer. 1673 */ 1674 slice(begin: number, end?: number): ArrayBuffer; 1675} 1676 1677/** 1678 * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays. 1679 */ 1680interface ArrayBufferTypes { 1681 ArrayBuffer: ArrayBuffer; 1682} 1683type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes]; 1684 1685interface ArrayBufferConstructor { 1686 readonly prototype: ArrayBuffer; 1687 new(byteLength: number): ArrayBuffer; 1688 isView(arg: any): arg is ArrayBufferView; 1689} 1690declare var ArrayBuffer: ArrayBufferConstructor; 1691 1692interface ArrayBufferView { 1693 /** 1694 * The ArrayBuffer instance referenced by the array. 1695 */ 1696 buffer: ArrayBufferLike; 1697 1698 /** 1699 * The length in bytes of the array. 1700 */ 1701 byteLength: number; 1702 1703 /** 1704 * The offset in bytes of the array. 1705 */ 1706 byteOffset: number; 1707} 1708 1709interface DataView { 1710 readonly buffer: ArrayBuffer; 1711 readonly byteLength: number; 1712 readonly byteOffset: number; 1713 /** 1714 * Gets the Float32 value at the specified byte offset from the start of the view. There is 1715 * no alignment constraint; multi-byte values may be fetched from any offset. 1716 * @param byteOffset The place in the buffer at which the value should be retrieved. 1717 * @param littleEndian If false or undefined, a big-endian value should be read. 1718 */ 1719 getFloat32(byteOffset: number, littleEndian?: boolean): number; 1720 1721 /** 1722 * Gets the Float64 value at the specified byte offset from the start of the view. There is 1723 * no alignment constraint; multi-byte values may be fetched from any offset. 1724 * @param byteOffset The place in the buffer at which the value should be retrieved. 1725 * @param littleEndian If false or undefined, a big-endian value should be read. 1726 */ 1727 getFloat64(byteOffset: number, littleEndian?: boolean): number; 1728 1729 /** 1730 * Gets the Int8 value at the specified byte offset from the start of the view. There is 1731 * no alignment constraint; multi-byte values may be fetched from any offset. 1732 * @param byteOffset The place in the buffer at which the value should be retrieved. 1733 */ 1734 getInt8(byteOffset: number): number; 1735 1736 /** 1737 * Gets the Int16 value at the specified byte offset from the start of the view. There is 1738 * no alignment constraint; multi-byte values may be fetched from any offset. 1739 * @param byteOffset The place in the buffer at which the value should be retrieved. 1740 * @param littleEndian If false or undefined, a big-endian value should be read. 1741 */ 1742 getInt16(byteOffset: number, littleEndian?: boolean): number; 1743 /** 1744 * Gets the Int32 value at the specified byte offset from the start of the view. There is 1745 * no alignment constraint; multi-byte values may be fetched from any offset. 1746 * @param byteOffset The place in the buffer at which the value should be retrieved. 1747 * @param littleEndian If false or undefined, a big-endian value should be read. 1748 */ 1749 getInt32(byteOffset: number, littleEndian?: boolean): number; 1750 1751 /** 1752 * Gets the Uint8 value at the specified byte offset from the start of the view. There is 1753 * no alignment constraint; multi-byte values may be fetched from any offset. 1754 * @param byteOffset The place in the buffer at which the value should be retrieved. 1755 */ 1756 getUint8(byteOffset: number): number; 1757 1758 /** 1759 * Gets the Uint16 value at the specified byte offset from the start of the view. There is 1760 * no alignment constraint; multi-byte values may be fetched from any offset. 1761 * @param byteOffset The place in the buffer at which the value should be retrieved. 1762 * @param littleEndian If false or undefined, a big-endian value should be read. 1763 */ 1764 getUint16(byteOffset: number, littleEndian?: boolean): number; 1765 1766 /** 1767 * Gets the Uint32 value at the specified byte offset from the start of the view. There is 1768 * no alignment constraint; multi-byte values may be fetched from any offset. 1769 * @param byteOffset The place in the buffer at which the value should be retrieved. 1770 * @param littleEndian If false or undefined, a big-endian value should be read. 1771 */ 1772 getUint32(byteOffset: number, littleEndian?: boolean): number; 1773 1774 /** 1775 * Stores an Float32 value at the specified byte offset from the start of the view. 1776 * @param byteOffset The place in the buffer at which the value should be set. 1777 * @param value The value to set. 1778 * @param littleEndian If false or undefined, a big-endian value should be written. 1779 */ 1780 setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; 1781 1782 /** 1783 * Stores an Float64 value at the specified byte offset from the start of the view. 1784 * @param byteOffset The place in the buffer at which the value should be set. 1785 * @param value The value to set. 1786 * @param littleEndian If false or undefined, a big-endian value should be written. 1787 */ 1788 setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; 1789 1790 /** 1791 * Stores an Int8 value at the specified byte offset from the start of the view. 1792 * @param byteOffset The place in the buffer at which the value should be set. 1793 * @param value The value to set. 1794 */ 1795 setInt8(byteOffset: number, value: number): void; 1796 1797 /** 1798 * Stores an Int16 value at the specified byte offset from the start of the view. 1799 * @param byteOffset The place in the buffer at which the value should be set. 1800 * @param value The value to set. 1801 * @param littleEndian If false or undefined, a big-endian value should be written. 1802 */ 1803 setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; 1804 1805 /** 1806 * Stores an Int32 value at the specified byte offset from the start of the view. 1807 * @param byteOffset The place in the buffer at which the value should be set. 1808 * @param value The value to set. 1809 * @param littleEndian If false or undefined, a big-endian value should be written. 1810 */ 1811 setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; 1812 1813 /** 1814 * Stores an Uint8 value at the specified byte offset from the start of the view. 1815 * @param byteOffset The place in the buffer at which the value should be set. 1816 * @param value The value to set. 1817 */ 1818 setUint8(byteOffset: number, value: number): void; 1819 1820 /** 1821 * Stores an Uint16 value at the specified byte offset from the start of the view. 1822 * @param byteOffset The place in the buffer at which the value should be set. 1823 * @param value The value to set. 1824 * @param littleEndian If false or undefined, a big-endian value should be written. 1825 */ 1826 setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; 1827 1828 /** 1829 * Stores an Uint32 value at the specified byte offset from the start of the view. 1830 * @param byteOffset The place in the buffer at which the value should be set. 1831 * @param value The value to set. 1832 * @param littleEndian If false or undefined, a big-endian value should be written. 1833 */ 1834 setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; 1835} 1836 1837interface DataViewConstructor { 1838 readonly prototype: DataView; 1839 new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView; 1840} 1841declare var DataView: DataViewConstructor; 1842 1843/** 1844 * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested 1845 * number of bytes could not be allocated an exception is raised. 1846 */ 1847interface Int8Array { 1848 /** 1849 * The size in bytes of each element in the array. 1850 */ 1851 readonly BYTES_PER_ELEMENT: number; 1852 1853 /** 1854 * The ArrayBuffer instance referenced by the array. 1855 */ 1856 readonly buffer: ArrayBufferLike; 1857 1858 /** 1859 * The length in bytes of the array. 1860 */ 1861 readonly byteLength: number; 1862 1863 /** 1864 * The offset in bytes of the array. 1865 */ 1866 readonly byteOffset: number; 1867 1868 /** 1869 * Returns the this object after copying a section of the array identified by start and end 1870 * to the same array starting at position target 1871 * @param target If target is negative, it is treated as length+target where length is the 1872 * length of the array. 1873 * @param start If start is negative, it is treated as length+start. If end is negative, it 1874 * is treated as length+end. 1875 * @param end If not specified, length of the this object is used as its default value. 1876 */ 1877 copyWithin(target: number, start: number, end?: number): this; 1878 1879 /** 1880 * Determines whether all the members of an array satisfy the specified test. 1881 * @param predicate A function that accepts up to three arguments. The every method calls 1882 * the predicate function for each element in the array until the predicate returns a value 1883 * which is coercible to the Boolean value false, or until the end of the array. 1884 * @param thisArg An object to which the this keyword can refer in the predicate function. 1885 * If thisArg is omitted, undefined is used as the this value. 1886 */ 1887 every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; 1888 1889 /** 1890 * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array 1891 * @param value value to fill array section with 1892 * @param start index to start filling the array at. If start is negative, it is treated as 1893 * length+start where length is the length of the array. 1894 * @param end index to stop filling the array at. If end is negative, it is treated as 1895 * length+end. 1896 */ 1897 fill(value: number, start?: number, end?: number): this; 1898 1899 /** 1900 * Returns the elements of an array that meet the condition specified in a callback function. 1901 * @param predicate A function that accepts up to three arguments. The filter method calls 1902 * the predicate function one time for each element in the array. 1903 * @param thisArg An object to which the this keyword can refer in the predicate function. 1904 * If thisArg is omitted, undefined is used as the this value. 1905 */ 1906 filter(predicate: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; 1907 1908 /** 1909 * Returns the value of the first element in the array where predicate is true, and undefined 1910 * otherwise. 1911 * @param predicate find calls predicate once for each element of the array, in ascending 1912 * order, until it finds one where predicate returns true. If such an element is found, find 1913 * immediately returns that element value. Otherwise, find returns undefined. 1914 * @param thisArg If provided, it will be used as the this value for each invocation of 1915 * predicate. If it is not provided, undefined is used instead. 1916 */ 1917 find(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number | undefined; 1918 1919 /** 1920 * Returns the index of the first element in the array where predicate is true, and -1 1921 * otherwise. 1922 * @param predicate find calls predicate once for each element of the array, in ascending 1923 * order, until it finds one where predicate returns true. If such an element is found, 1924 * findIndex immediately returns that element index. Otherwise, findIndex returns -1. 1925 * @param thisArg If provided, it will be used as the this value for each invocation of 1926 * predicate. If it is not provided, undefined is used instead. 1927 */ 1928 findIndex(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number; 1929 1930 /** 1931 * Performs the specified action for each element in an array. 1932 * @param callbackfn A function that accepts up to three arguments. forEach calls the 1933 * callbackfn function one time for each element in the array. 1934 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 1935 * If thisArg is omitted, undefined is used as the this value. 1936 */ 1937 forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; 1938 1939 /** 1940 * Returns the index of the first occurrence of a value in an array. 1941 * @param searchElement The value to locate in the array. 1942 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 1943 * search starts at index 0. 1944 */ 1945 indexOf(searchElement: number, fromIndex?: number): number; 1946 1947 /** 1948 * Adds all the elements of an array separated by the specified separator string. 1949 * @param separator A string used to separate one element of an array from the next in the 1950 * resulting String. If omitted, the array elements are separated with a comma. 1951 */ 1952 join(separator?: string): string; 1953 1954 /** 1955 * Returns the index of the last occurrence of a value in an array. 1956 * @param searchElement The value to locate in the array. 1957 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 1958 * search starts at index 0. 1959 */ 1960 lastIndexOf(searchElement: number, fromIndex?: number): number; 1961 1962 /** 1963 * The length of the array. 1964 */ 1965 readonly length: number; 1966 1967 /** 1968 * Calls a defined callback function on each element of an array, and returns an array that 1969 * contains the results. 1970 * @param callbackfn A function that accepts up to three arguments. The map method calls the 1971 * callbackfn function one time for each element in the array. 1972 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 1973 * If thisArg is omitted, undefined is used as the this value. 1974 */ 1975 map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; 1976 1977 /** 1978 * Calls the specified callback function for all the elements in an array. The return value of 1979 * the callback function is the accumulated result, and is provided as an argument in the next 1980 * call to the callback function. 1981 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 1982 * callbackfn function one time for each element in the array. 1983 * @param initialValue If initialValue is specified, it is used as the initial value to start 1984 * the accumulation. The first call to the callbackfn function provides this value as an argument 1985 * instead of an array value. 1986 */ 1987 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; 1988 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; 1989 1990 /** 1991 * Calls the specified callback function for all the elements in an array. The return value of 1992 * the callback function is the accumulated result, and is provided as an argument in the next 1993 * call to the callback function. 1994 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 1995 * callbackfn function one time for each element in the array. 1996 * @param initialValue If initialValue is specified, it is used as the initial value to start 1997 * the accumulation. The first call to the callbackfn function provides this value as an argument 1998 * instead of an array value. 1999 */ 2000 reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; 2001 2002 /** 2003 * Calls the specified callback function for all the elements in an array, in descending order. 2004 * The return value of the callback function is the accumulated result, and is provided as an 2005 * argument in the next call to the callback function. 2006 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 2007 * the callbackfn function one time for each element in the array. 2008 * @param initialValue If initialValue is specified, it is used as the initial value to start 2009 * the accumulation. The first call to the callbackfn function provides this value as an 2010 * argument instead of an array value. 2011 */ 2012 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; 2013 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; 2014 2015 /** 2016 * Calls the specified callback function for all the elements in an array, in descending order. 2017 * The return value of the callback function is the accumulated result, and is provided as an 2018 * argument in the next call to the callback function. 2019 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 2020 * the callbackfn function one time for each element in the array. 2021 * @param initialValue If initialValue is specified, it is used as the initial value to start 2022 * the accumulation. The first call to the callbackfn function provides this value as an argument 2023 * instead of an array value. 2024 */ 2025 reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; 2026 2027 /** 2028 * Reverses the elements in an Array. 2029 */ 2030 reverse(): Int8Array; 2031 2032 /** 2033 * Sets a value or an array of values. 2034 * @param array A typed or untyped array of values to set. 2035 * @param offset The index in the current array at which the values are to be written. 2036 */ 2037 set(array: ArrayLike<number>, offset?: number): void; 2038 2039 /** 2040 * Returns a section of an array. 2041 * @param start The beginning of the specified portion of the array. 2042 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 2043 */ 2044 slice(start?: number, end?: number): Int8Array; 2045 2046 /** 2047 * Determines whether the specified callback function returns true for any element of an array. 2048 * @param predicate A function that accepts up to three arguments. The some method calls 2049 * the predicate function for each element in the array until the predicate returns a value 2050 * which is coercible to the Boolean value true, or until the end of the array. 2051 * @param thisArg An object to which the this keyword can refer in the predicate function. 2052 * If thisArg is omitted, undefined is used as the this value. 2053 */ 2054 some(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; 2055 2056 /** 2057 * Sorts an array. 2058 * @param compareFn Function used to determine the order of the elements. It is expected to return 2059 * a negative value if first argument is less than second argument, zero if they're equal and a positive 2060 * value otherwise. If omitted, the elements are sorted in ascending order. 2061 * ```ts 2062 * [11,2,22,1].sort((a, b) => a - b) 2063 * ``` 2064 */ 2065 sort(compareFn?: (a: number, b: number) => number): this; 2066 2067 /** 2068 * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements 2069 * at begin, inclusive, up to end, exclusive. 2070 * @param begin The index of the beginning of the array. 2071 * @param end The index of the end of the array. 2072 */ 2073 subarray(begin?: number, end?: number): Int8Array; 2074 2075 /** 2076 * Converts a number to a string by using the current locale. 2077 */ 2078 toLocaleString(): string; 2079 2080 /** 2081 * Returns a string representation of an array. 2082 */ 2083 toString(): string; 2084 2085 /** Returns the primitive value of the specified object. */ 2086 valueOf(): Int8Array; 2087 2088 [index: number]: number; 2089} 2090interface Int8ArrayConstructor { 2091 readonly prototype: Int8Array; 2092 new(length: number): Int8Array; 2093 new(array: ArrayLike<number> | ArrayBufferLike): Int8Array; 2094 new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array; 2095 2096 /** 2097 * The size in bytes of each element in the array. 2098 */ 2099 readonly BYTES_PER_ELEMENT: number; 2100 2101 /** 2102 * Returns a new array from a set of elements. 2103 * @param items A set of elements to include in the new array object. 2104 */ 2105 of(...items: number[]): Int8Array; 2106 2107 /** 2108 * Creates an array from an array-like or iterable object. 2109 * @param arrayLike An array-like or iterable object to convert to an array. 2110 */ 2111 from(arrayLike: ArrayLike<number>): Int8Array; 2112 2113 /** 2114 * Creates an array from an array-like or iterable object. 2115 * @param arrayLike An array-like or iterable object to convert to an array. 2116 * @param mapfn A mapping function to call on every element of the array. 2117 * @param thisArg Value of 'this' used to invoke the mapfn. 2118 */ 2119 from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; 2120 2121 2122} 2123declare var Int8Array: Int8ArrayConstructor; 2124 2125/** 2126 * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the 2127 * requested number of bytes could not be allocated an exception is raised. 2128 */ 2129interface Uint8Array { 2130 /** 2131 * The size in bytes of each element in the array. 2132 */ 2133 readonly BYTES_PER_ELEMENT: number; 2134 2135 /** 2136 * The ArrayBuffer instance referenced by the array. 2137 */ 2138 readonly buffer: ArrayBufferLike; 2139 2140 /** 2141 * The length in bytes of the array. 2142 */ 2143 readonly byteLength: number; 2144 2145 /** 2146 * The offset in bytes of the array. 2147 */ 2148 readonly byteOffset: number; 2149 2150 /** 2151 * Returns the this object after copying a section of the array identified by start and end 2152 * to the same array starting at position target 2153 * @param target If target is negative, it is treated as length+target where length is the 2154 * length of the array. 2155 * @param start If start is negative, it is treated as length+start. If end is negative, it 2156 * is treated as length+end. 2157 * @param end If not specified, length of the this object is used as its default value. 2158 */ 2159 copyWithin(target: number, start: number, end?: number): this; 2160 2161 /** 2162 * Determines whether all the members of an array satisfy the specified test. 2163 * @param predicate A function that accepts up to three arguments. The every method calls 2164 * the predicate function for each element in the array until the predicate returns a value 2165 * which is coercible to the Boolean value false, or until the end of the array. 2166 * @param thisArg An object to which the this keyword can refer in the predicate function. 2167 * If thisArg is omitted, undefined is used as the this value. 2168 */ 2169 every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; 2170 2171 /** 2172 * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array 2173 * @param value value to fill array section with 2174 * @param start index to start filling the array at. If start is negative, it is treated as 2175 * length+start where length is the length of the array. 2176 * @param end index to stop filling the array at. If end is negative, it is treated as 2177 * length+end. 2178 */ 2179 fill(value: number, start?: number, end?: number): this; 2180 2181 /** 2182 * Returns the elements of an array that meet the condition specified in a callback function. 2183 * @param predicate A function that accepts up to three arguments. The filter method calls 2184 * the predicate function one time for each element in the array. 2185 * @param thisArg An object to which the this keyword can refer in the predicate function. 2186 * If thisArg is omitted, undefined is used as the this value. 2187 */ 2188 filter(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; 2189 2190 /** 2191 * Returns the value of the first element in the array where predicate is true, and undefined 2192 * otherwise. 2193 * @param predicate find calls predicate once for each element of the array, in ascending 2194 * order, until it finds one where predicate returns true. If such an element is found, find 2195 * immediately returns that element value. Otherwise, find returns undefined. 2196 * @param thisArg If provided, it will be used as the this value for each invocation of 2197 * predicate. If it is not provided, undefined is used instead. 2198 */ 2199 find(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number | undefined; 2200 2201 /** 2202 * Returns the index of the first element in the array where predicate is true, and -1 2203 * otherwise. 2204 * @param predicate find calls predicate once for each element of the array, in ascending 2205 * order, until it finds one where predicate returns true. If such an element is found, 2206 * findIndex immediately returns that element index. Otherwise, findIndex returns -1. 2207 * @param thisArg If provided, it will be used as the this value for each invocation of 2208 * predicate. If it is not provided, undefined is used instead. 2209 */ 2210 findIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; 2211 2212 /** 2213 * Performs the specified action for each element in an array. 2214 * @param callbackfn A function that accepts up to three arguments. forEach calls the 2215 * callbackfn function one time for each element in the array. 2216 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 2217 * If thisArg is omitted, undefined is used as the this value. 2218 */ 2219 forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; 2220 2221 /** 2222 * Returns the index of the first occurrence of a value in an array. 2223 * @param searchElement The value to locate in the array. 2224 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 2225 * search starts at index 0. 2226 */ 2227 indexOf(searchElement: number, fromIndex?: number): number; 2228 2229 /** 2230 * Adds all the elements of an array separated by the specified separator string. 2231 * @param separator A string used to separate one element of an array from the next in the 2232 * resulting String. If omitted, the array elements are separated with a comma. 2233 */ 2234 join(separator?: string): string; 2235 2236 /** 2237 * Returns the index of the last occurrence of a value in an array. 2238 * @param searchElement The value to locate in the array. 2239 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 2240 * search starts at index 0. 2241 */ 2242 lastIndexOf(searchElement: number, fromIndex?: number): number; 2243 2244 /** 2245 * The length of the array. 2246 */ 2247 readonly length: number; 2248 2249 /** 2250 * Calls a defined callback function on each element of an array, and returns an array that 2251 * contains the results. 2252 * @param callbackfn A function that accepts up to three arguments. The map method calls the 2253 * callbackfn function one time for each element in the array. 2254 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 2255 * If thisArg is omitted, undefined is used as the this value. 2256 */ 2257 map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; 2258 2259 /** 2260 * Calls the specified callback function for all the elements in an array. The return value of 2261 * the callback function is the accumulated result, and is provided as an argument in the next 2262 * call to the callback function. 2263 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 2264 * callbackfn function one time for each element in the array. 2265 * @param initialValue If initialValue is specified, it is used as the initial value to start 2266 * the accumulation. The first call to the callbackfn function provides this value as an argument 2267 * instead of an array value. 2268 */ 2269 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; 2270 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; 2271 2272 /** 2273 * Calls the specified callback function for all the elements in an array. The return value of 2274 * the callback function is the accumulated result, and is provided as an argument in the next 2275 * call to the callback function. 2276 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 2277 * callbackfn function one time for each element in the array. 2278 * @param initialValue If initialValue is specified, it is used as the initial value to start 2279 * the accumulation. The first call to the callbackfn function provides this value as an argument 2280 * instead of an array value. 2281 */ 2282 reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; 2283 2284 /** 2285 * Calls the specified callback function for all the elements in an array, in descending order. 2286 * The return value of the callback function is the accumulated result, and is provided as an 2287 * argument in the next call to the callback function. 2288 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 2289 * the callbackfn function one time for each element in the array. 2290 * @param initialValue If initialValue is specified, it is used as the initial value to start 2291 * the accumulation. The first call to the callbackfn function provides this value as an 2292 * argument instead of an array value. 2293 */ 2294 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; 2295 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; 2296 2297 /** 2298 * Calls the specified callback function for all the elements in an array, in descending order. 2299 * The return value of the callback function is the accumulated result, and is provided as an 2300 * argument in the next call to the callback function. 2301 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 2302 * the callbackfn function one time for each element in the array. 2303 * @param initialValue If initialValue is specified, it is used as the initial value to start 2304 * the accumulation. The first call to the callbackfn function provides this value as an argument 2305 * instead of an array value. 2306 */ 2307 reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; 2308 2309 /** 2310 * Reverses the elements in an Array. 2311 */ 2312 reverse(): Uint8Array; 2313 2314 /** 2315 * Sets a value or an array of values. 2316 * @param array A typed or untyped array of values to set. 2317 * @param offset The index in the current array at which the values are to be written. 2318 */ 2319 set(array: ArrayLike<number>, offset?: number): void; 2320 2321 /** 2322 * Returns a section of an array. 2323 * @param start The beginning of the specified portion of the array. 2324 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 2325 */ 2326 slice(start?: number, end?: number): Uint8Array; 2327 2328 /** 2329 * Determines whether the specified callback function returns true for any element of an array. 2330 * @param predicate A function that accepts up to three arguments. The some method calls 2331 * the predicate function for each element in the array until the predicate returns a value 2332 * which is coercible to the Boolean value true, or until the end of the array. 2333 * @param thisArg An object to which the this keyword can refer in the predicate function. 2334 * If thisArg is omitted, undefined is used as the this value. 2335 */ 2336 some(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; 2337 2338 /** 2339 * Sorts an array. 2340 * @param compareFn Function used to determine the order of the elements. It is expected to return 2341 * a negative value if first argument is less than second argument, zero if they're equal and a positive 2342 * value otherwise. If omitted, the elements are sorted in ascending order. 2343 * ```ts 2344 * [11,2,22,1].sort((a, b) => a - b) 2345 * ``` 2346 */ 2347 sort(compareFn?: (a: number, b: number) => number): this; 2348 2349 /** 2350 * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements 2351 * at begin, inclusive, up to end, exclusive. 2352 * @param begin The index of the beginning of the array. 2353 * @param end The index of the end of the array. 2354 */ 2355 subarray(begin?: number, end?: number): Uint8Array; 2356 2357 /** 2358 * Converts a number to a string by using the current locale. 2359 */ 2360 toLocaleString(): string; 2361 2362 /** 2363 * Returns a string representation of an array. 2364 */ 2365 toString(): string; 2366 2367 /** Returns the primitive value of the specified object. */ 2368 valueOf(): Uint8Array; 2369 2370 [index: number]: number; 2371} 2372 2373interface Uint8ArrayConstructor { 2374 readonly prototype: Uint8Array; 2375 new(length: number): Uint8Array; 2376 new(array: ArrayLike<number> | ArrayBufferLike): Uint8Array; 2377 new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array; 2378 2379 /** 2380 * The size in bytes of each element in the array. 2381 */ 2382 readonly BYTES_PER_ELEMENT: number; 2383 2384 /** 2385 * Returns a new array from a set of elements. 2386 * @param items A set of elements to include in the new array object. 2387 */ 2388 of(...items: number[]): Uint8Array; 2389 2390 /** 2391 * Creates an array from an array-like or iterable object. 2392 * @param arrayLike An array-like or iterable object to convert to an array. 2393 */ 2394 from(arrayLike: ArrayLike<number>): Uint8Array; 2395 2396 /** 2397 * Creates an array from an array-like or iterable object. 2398 * @param arrayLike An array-like or iterable object to convert to an array. 2399 * @param mapfn A mapping function to call on every element of the array. 2400 * @param thisArg Value of 'this' used to invoke the mapfn. 2401 */ 2402 from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; 2403 2404} 2405declare var Uint8Array: Uint8ArrayConstructor; 2406 2407/** 2408 * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. 2409 * If the requested number of bytes could not be allocated an exception is raised. 2410 */ 2411interface Uint8ClampedArray { 2412 /** 2413 * The size in bytes of each element in the array. 2414 */ 2415 readonly BYTES_PER_ELEMENT: number; 2416 2417 /** 2418 * The ArrayBuffer instance referenced by the array. 2419 */ 2420 readonly buffer: ArrayBufferLike; 2421 2422 /** 2423 * The length in bytes of the array. 2424 */ 2425 readonly byteLength: number; 2426 2427 /** 2428 * The offset in bytes of the array. 2429 */ 2430 readonly byteOffset: number; 2431 2432 /** 2433 * Returns the this object after copying a section of the array identified by start and end 2434 * to the same array starting at position target 2435 * @param target If target is negative, it is treated as length+target where length is the 2436 * length of the array. 2437 * @param start If start is negative, it is treated as length+start. If end is negative, it 2438 * is treated as length+end. 2439 * @param end If not specified, length of the this object is used as its default value. 2440 */ 2441 copyWithin(target: number, start: number, end?: number): this; 2442 2443 /** 2444 * Determines whether all the members of an array satisfy the specified test. 2445 * @param predicate A function that accepts up to three arguments. The every method calls 2446 * the predicate function for each element in the array until the predicate returns a value 2447 * which is coercible to the Boolean value false, or until the end of the array. 2448 * @param thisArg An object to which the this keyword can refer in the predicate function. 2449 * If thisArg is omitted, undefined is used as the this value. 2450 */ 2451 every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; 2452 2453 /** 2454 * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array 2455 * @param value value to fill array section with 2456 * @param start index to start filling the array at. If start is negative, it is treated as 2457 * length+start where length is the length of the array. 2458 * @param end index to stop filling the array at. If end is negative, it is treated as 2459 * length+end. 2460 */ 2461 fill(value: number, start?: number, end?: number): this; 2462 2463 /** 2464 * Returns the elements of an array that meet the condition specified in a callback function. 2465 * @param predicate A function that accepts up to three arguments. The filter method calls 2466 * the predicate function one time for each element in the array. 2467 * @param thisArg An object to which the this keyword can refer in the predicate function. 2468 * If thisArg is omitted, undefined is used as the this value. 2469 */ 2470 filter(predicate: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; 2471 2472 /** 2473 * Returns the value of the first element in the array where predicate is true, and undefined 2474 * otherwise. 2475 * @param predicate find calls predicate once for each element of the array, in ascending 2476 * order, until it finds one where predicate returns true. If such an element is found, find 2477 * immediately returns that element value. Otherwise, find returns undefined. 2478 * @param thisArg If provided, it will be used as the this value for each invocation of 2479 * predicate. If it is not provided, undefined is used instead. 2480 */ 2481 find(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number | undefined; 2482 2483 /** 2484 * Returns the index of the first element in the array where predicate is true, and -1 2485 * otherwise. 2486 * @param predicate find calls predicate once for each element of the array, in ascending 2487 * order, until it finds one where predicate returns true. If such an element is found, 2488 * findIndex immediately returns that element index. Otherwise, findIndex returns -1. 2489 * @param thisArg If provided, it will be used as the this value for each invocation of 2490 * predicate. If it is not provided, undefined is used instead. 2491 */ 2492 findIndex(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number; 2493 2494 /** 2495 * Performs the specified action for each element in an array. 2496 * @param callbackfn A function that accepts up to three arguments. forEach calls the 2497 * callbackfn function one time for each element in the array. 2498 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 2499 * If thisArg is omitted, undefined is used as the this value. 2500 */ 2501 forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; 2502 2503 /** 2504 * Returns the index of the first occurrence of a value in an array. 2505 * @param searchElement The value to locate in the array. 2506 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 2507 * search starts at index 0. 2508 */ 2509 indexOf(searchElement: number, fromIndex?: number): number; 2510 2511 /** 2512 * Adds all the elements of an array separated by the specified separator string. 2513 * @param separator A string used to separate one element of an array from the next in the 2514 * resulting String. If omitted, the array elements are separated with a comma. 2515 */ 2516 join(separator?: string): string; 2517 2518 /** 2519 * Returns the index of the last occurrence of a value in an array. 2520 * @param searchElement The value to locate in the array. 2521 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 2522 * search starts at index 0. 2523 */ 2524 lastIndexOf(searchElement: number, fromIndex?: number): number; 2525 2526 /** 2527 * The length of the array. 2528 */ 2529 readonly length: number; 2530 2531 /** 2532 * Calls a defined callback function on each element of an array, and returns an array that 2533 * contains the results. 2534 * @param callbackfn A function that accepts up to three arguments. The map method calls the 2535 * callbackfn function one time for each element in the array. 2536 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 2537 * If thisArg is omitted, undefined is used as the this value. 2538 */ 2539 map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; 2540 2541 /** 2542 * Calls the specified callback function for all the elements in an array. The return value of 2543 * the callback function is the accumulated result, and is provided as an argument in the next 2544 * call to the callback function. 2545 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 2546 * callbackfn function one time for each element in the array. 2547 * @param initialValue If initialValue is specified, it is used as the initial value to start 2548 * the accumulation. The first call to the callbackfn function provides this value as an argument 2549 * instead of an array value. 2550 */ 2551 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; 2552 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; 2553 2554 /** 2555 * Calls the specified callback function for all the elements in an array. The return value of 2556 * the callback function is the accumulated result, and is provided as an argument in the next 2557 * call to the callback function. 2558 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 2559 * callbackfn function one time for each element in the array. 2560 * @param initialValue If initialValue is specified, it is used as the initial value to start 2561 * the accumulation. The first call to the callbackfn function provides this value as an argument 2562 * instead of an array value. 2563 */ 2564 reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; 2565 2566 /** 2567 * Calls the specified callback function for all the elements in an array, in descending order. 2568 * The return value of the callback function is the accumulated result, and is provided as an 2569 * argument in the next call to the callback function. 2570 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 2571 * the callbackfn function one time for each element in the array. 2572 * @param initialValue If initialValue is specified, it is used as the initial value to start 2573 * the accumulation. The first call to the callbackfn function provides this value as an 2574 * argument instead of an array value. 2575 */ 2576 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; 2577 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; 2578 2579 /** 2580 * Calls the specified callback function for all the elements in an array, in descending order. 2581 * The return value of the callback function is the accumulated result, and is provided as an 2582 * argument in the next call to the callback function. 2583 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 2584 * the callbackfn function one time for each element in the array. 2585 * @param initialValue If initialValue is specified, it is used as the initial value to start 2586 * the accumulation. The first call to the callbackfn function provides this value as an argument 2587 * instead of an array value. 2588 */ 2589 reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; 2590 2591 /** 2592 * Reverses the elements in an Array. 2593 */ 2594 reverse(): Uint8ClampedArray; 2595 2596 /** 2597 * Sets a value or an array of values. 2598 * @param array A typed or untyped array of values to set. 2599 * @param offset The index in the current array at which the values are to be written. 2600 */ 2601 set(array: ArrayLike<number>, offset?: number): void; 2602 2603 /** 2604 * Returns a section of an array. 2605 * @param start The beginning of the specified portion of the array. 2606 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 2607 */ 2608 slice(start?: number, end?: number): Uint8ClampedArray; 2609 2610 /** 2611 * Determines whether the specified callback function returns true for any element of an array. 2612 * @param predicate A function that accepts up to three arguments. The some method calls 2613 * the predicate function for each element in the array until the predicate returns a value 2614 * which is coercible to the Boolean value true, or until the end of the array. 2615 * @param thisArg An object to which the this keyword can refer in the predicate function. 2616 * If thisArg is omitted, undefined is used as the this value. 2617 */ 2618 some(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; 2619 2620 /** 2621 * Sorts an array. 2622 * @param compareFn Function used to determine the order of the elements. It is expected to return 2623 * a negative value if first argument is less than second argument, zero if they're equal and a positive 2624 * value otherwise. If omitted, the elements are sorted in ascending order. 2625 * ```ts 2626 * [11,2,22,1].sort((a, b) => a - b) 2627 * ``` 2628 */ 2629 sort(compareFn?: (a: number, b: number) => number): this; 2630 2631 /** 2632 * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements 2633 * at begin, inclusive, up to end, exclusive. 2634 * @param begin The index of the beginning of the array. 2635 * @param end The index of the end of the array. 2636 */ 2637 subarray(begin?: number, end?: number): Uint8ClampedArray; 2638 2639 /** 2640 * Converts a number to a string by using the current locale. 2641 */ 2642 toLocaleString(): string; 2643 2644 /** 2645 * Returns a string representation of an array. 2646 */ 2647 toString(): string; 2648 2649 /** Returns the primitive value of the specified object. */ 2650 valueOf(): Uint8ClampedArray; 2651 2652 [index: number]: number; 2653} 2654 2655interface Uint8ClampedArrayConstructor { 2656 readonly prototype: Uint8ClampedArray; 2657 new(length: number): Uint8ClampedArray; 2658 new(array: ArrayLike<number> | ArrayBufferLike): Uint8ClampedArray; 2659 new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray; 2660 2661 /** 2662 * The size in bytes of each element in the array. 2663 */ 2664 readonly BYTES_PER_ELEMENT: number; 2665 2666 /** 2667 * Returns a new array from a set of elements. 2668 * @param items A set of elements to include in the new array object. 2669 */ 2670 of(...items: number[]): Uint8ClampedArray; 2671 2672 /** 2673 * Creates an array from an array-like or iterable object. 2674 * @param arrayLike An array-like or iterable object to convert to an array. 2675 */ 2676 from(arrayLike: ArrayLike<number>): Uint8ClampedArray; 2677 2678 /** 2679 * Creates an array from an array-like or iterable object. 2680 * @param arrayLike An array-like or iterable object to convert to an array. 2681 * @param mapfn A mapping function to call on every element of the array. 2682 * @param thisArg Value of 'this' used to invoke the mapfn. 2683 */ 2684 from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; 2685} 2686declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; 2687 2688/** 2689 * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the 2690 * requested number of bytes could not be allocated an exception is raised. 2691 */ 2692interface Int16Array { 2693 /** 2694 * The size in bytes of each element in the array. 2695 */ 2696 readonly BYTES_PER_ELEMENT: number; 2697 2698 /** 2699 * The ArrayBuffer instance referenced by the array. 2700 */ 2701 readonly buffer: ArrayBufferLike; 2702 2703 /** 2704 * The length in bytes of the array. 2705 */ 2706 readonly byteLength: number; 2707 2708 /** 2709 * The offset in bytes of the array. 2710 */ 2711 readonly byteOffset: number; 2712 2713 /** 2714 * Returns the this object after copying a section of the array identified by start and end 2715 * to the same array starting at position target 2716 * @param target If target is negative, it is treated as length+target where length is the 2717 * length of the array. 2718 * @param start If start is negative, it is treated as length+start. If end is negative, it 2719 * is treated as length+end. 2720 * @param end If not specified, length of the this object is used as its default value. 2721 */ 2722 copyWithin(target: number, start: number, end?: number): this; 2723 2724 /** 2725 * Determines whether all the members of an array satisfy the specified test. 2726 * @param predicate A function that accepts up to three arguments. The every method calls 2727 * the predicate function for each element in the array until the predicate returns a value 2728 * which is coercible to the Boolean value false, or until the end of the array. 2729 * @param thisArg An object to which the this keyword can refer in the predicate function. 2730 * If thisArg is omitted, undefined is used as the this value. 2731 */ 2732 every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; 2733 2734 /** 2735 * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array 2736 * @param value value to fill array section with 2737 * @param start index to start filling the array at. If start is negative, it is treated as 2738 * length+start where length is the length of the array. 2739 * @param end index to stop filling the array at. If end is negative, it is treated as 2740 * length+end. 2741 */ 2742 fill(value: number, start?: number, end?: number): this; 2743 2744 /** 2745 * Returns the elements of an array that meet the condition specified in a callback function. 2746 * @param predicate A function that accepts up to three arguments. The filter method calls 2747 * the predicate function one time for each element in the array. 2748 * @param thisArg An object to which the this keyword can refer in the predicate function. 2749 * If thisArg is omitted, undefined is used as the this value. 2750 */ 2751 filter(predicate: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; 2752 2753 /** 2754 * Returns the value of the first element in the array where predicate is true, and undefined 2755 * otherwise. 2756 * @param predicate find calls predicate once for each element of the array, in ascending 2757 * order, until it finds one where predicate returns true. If such an element is found, find 2758 * immediately returns that element value. Otherwise, find returns undefined. 2759 * @param thisArg If provided, it will be used as the this value for each invocation of 2760 * predicate. If it is not provided, undefined is used instead. 2761 */ 2762 find(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number | undefined; 2763 2764 /** 2765 * Returns the index of the first element in the array where predicate is true, and -1 2766 * otherwise. 2767 * @param predicate find calls predicate once for each element of the array, in ascending 2768 * order, until it finds one where predicate returns true. If such an element is found, 2769 * findIndex immediately returns that element index. Otherwise, findIndex returns -1. 2770 * @param thisArg If provided, it will be used as the this value for each invocation of 2771 * predicate. If it is not provided, undefined is used instead. 2772 */ 2773 findIndex(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number; 2774 2775 /** 2776 * Performs the specified action for each element in an array. 2777 * @param callbackfn A function that accepts up to three arguments. forEach calls the 2778 * callbackfn function one time for each element in the array. 2779 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 2780 * If thisArg is omitted, undefined is used as the this value. 2781 */ 2782 forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; 2783 /** 2784 * Returns the index of the first occurrence of a value in an array. 2785 * @param searchElement The value to locate in the array. 2786 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 2787 * search starts at index 0. 2788 */ 2789 indexOf(searchElement: number, fromIndex?: number): number; 2790 2791 /** 2792 * Adds all the elements of an array separated by the specified separator string. 2793 * @param separator A string used to separate one element of an array from the next in the 2794 * resulting String. If omitted, the array elements are separated with a comma. 2795 */ 2796 join(separator?: string): string; 2797 2798 /** 2799 * Returns the index of the last occurrence of a value in an array. 2800 * @param searchElement The value to locate in the array. 2801 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 2802 * search starts at index 0. 2803 */ 2804 lastIndexOf(searchElement: number, fromIndex?: number): number; 2805 2806 /** 2807 * The length of the array. 2808 */ 2809 readonly length: number; 2810 2811 /** 2812 * Calls a defined callback function on each element of an array, and returns an array that 2813 * contains the results. 2814 * @param callbackfn A function that accepts up to three arguments. The map method calls the 2815 * callbackfn function one time for each element in the array. 2816 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 2817 * If thisArg is omitted, undefined is used as the this value. 2818 */ 2819 map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; 2820 2821 /** 2822 * Calls the specified callback function for all the elements in an array. The return value of 2823 * the callback function is the accumulated result, and is provided as an argument in the next 2824 * call to the callback function. 2825 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 2826 * callbackfn function one time for each element in the array. 2827 * @param initialValue If initialValue is specified, it is used as the initial value to start 2828 * the accumulation. The first call to the callbackfn function provides this value as an argument 2829 * instead of an array value. 2830 */ 2831 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; 2832 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; 2833 2834 /** 2835 * Calls the specified callback function for all the elements in an array. The return value of 2836 * the callback function is the accumulated result, and is provided as an argument in the next 2837 * call to the callback function. 2838 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 2839 * callbackfn function one time for each element in the array. 2840 * @param initialValue If initialValue is specified, it is used as the initial value to start 2841 * the accumulation. The first call to the callbackfn function provides this value as an argument 2842 * instead of an array value. 2843 */ 2844 reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; 2845 2846 /** 2847 * Calls the specified callback function for all the elements in an array, in descending order. 2848 * The return value of the callback function is the accumulated result, and is provided as an 2849 * argument in the next call to the callback function. 2850 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 2851 * the callbackfn function one time for each element in the array. 2852 * @param initialValue If initialValue is specified, it is used as the initial value to start 2853 * the accumulation. The first call to the callbackfn function provides this value as an 2854 * argument instead of an array value. 2855 */ 2856 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; 2857 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; 2858 2859 /** 2860 * Calls the specified callback function for all the elements in an array, in descending order. 2861 * The return value of the callback function is the accumulated result, and is provided as an 2862 * argument in the next call to the callback function. 2863 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 2864 * the callbackfn function one time for each element in the array. 2865 * @param initialValue If initialValue is specified, it is used as the initial value to start 2866 * the accumulation. The first call to the callbackfn function provides this value as an argument 2867 * instead of an array value. 2868 */ 2869 reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; 2870 2871 /** 2872 * Reverses the elements in an Array. 2873 */ 2874 reverse(): Int16Array; 2875 2876 /** 2877 * Sets a value or an array of values. 2878 * @param array A typed or untyped array of values to set. 2879 * @param offset The index in the current array at which the values are to be written. 2880 */ 2881 set(array: ArrayLike<number>, offset?: number): void; 2882 2883 /** 2884 * Returns a section of an array. 2885 * @param start The beginning of the specified portion of the array. 2886 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 2887 */ 2888 slice(start?: number, end?: number): Int16Array; 2889 2890 /** 2891 * Determines whether the specified callback function returns true for any element of an array. 2892 * @param predicate A function that accepts up to three arguments. The some method calls 2893 * the predicate function for each element in the array until the predicate returns a value 2894 * which is coercible to the Boolean value true, or until the end of the array. 2895 * @param thisArg An object to which the this keyword can refer in the predicate function. 2896 * If thisArg is omitted, undefined is used as the this value. 2897 */ 2898 some(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; 2899 2900 /** 2901 * Sorts an array. 2902 * @param compareFn Function used to determine the order of the elements. It is expected to return 2903 * a negative value if first argument is less than second argument, zero if they're equal and a positive 2904 * value otherwise. If omitted, the elements are sorted in ascending order. 2905 * ```ts 2906 * [11,2,22,1].sort((a, b) => a - b) 2907 * ``` 2908 */ 2909 sort(compareFn?: (a: number, b: number) => number): this; 2910 2911 /** 2912 * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements 2913 * at begin, inclusive, up to end, exclusive. 2914 * @param begin The index of the beginning of the array. 2915 * @param end The index of the end of the array. 2916 */ 2917 subarray(begin?: number, end?: number): Int16Array; 2918 2919 /** 2920 * Converts a number to a string by using the current locale. 2921 */ 2922 toLocaleString(): string; 2923 2924 /** 2925 * Returns a string representation of an array. 2926 */ 2927 toString(): string; 2928 2929 /** Returns the primitive value of the specified object. */ 2930 valueOf(): Int16Array; 2931 2932 [index: number]: number; 2933} 2934 2935interface Int16ArrayConstructor { 2936 readonly prototype: Int16Array; 2937 new(length: number): Int16Array; 2938 new(array: ArrayLike<number> | ArrayBufferLike): Int16Array; 2939 new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array; 2940 2941 /** 2942 * The size in bytes of each element in the array. 2943 */ 2944 readonly BYTES_PER_ELEMENT: number; 2945 2946 /** 2947 * Returns a new array from a set of elements. 2948 * @param items A set of elements to include in the new array object. 2949 */ 2950 of(...items: number[]): Int16Array; 2951 2952 /** 2953 * Creates an array from an array-like or iterable object. 2954 * @param arrayLike An array-like or iterable object to convert to an array. 2955 */ 2956 from(arrayLike: ArrayLike<number>): Int16Array; 2957 2958 /** 2959 * Creates an array from an array-like or iterable object. 2960 * @param arrayLike An array-like or iterable object to convert to an array. 2961 * @param mapfn A mapping function to call on every element of the array. 2962 * @param thisArg Value of 'this' used to invoke the mapfn. 2963 */ 2964 from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; 2965 2966 2967} 2968declare var Int16Array: Int16ArrayConstructor; 2969 2970/** 2971 * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the 2972 * requested number of bytes could not be allocated an exception is raised. 2973 */ 2974interface Uint16Array { 2975 /** 2976 * The size in bytes of each element in the array. 2977 */ 2978 readonly BYTES_PER_ELEMENT: number; 2979 2980 /** 2981 * The ArrayBuffer instance referenced by the array. 2982 */ 2983 readonly buffer: ArrayBufferLike; 2984 2985 /** 2986 * The length in bytes of the array. 2987 */ 2988 readonly byteLength: number; 2989 2990 /** 2991 * The offset in bytes of the array. 2992 */ 2993 readonly byteOffset: number; 2994 2995 /** 2996 * Returns the this object after copying a section of the array identified by start and end 2997 * to the same array starting at position target 2998 * @param target If target is negative, it is treated as length+target where length is the 2999 * length of the array. 3000 * @param start If start is negative, it is treated as length+start. If end is negative, it 3001 * is treated as length+end. 3002 * @param end If not specified, length of the this object is used as its default value. 3003 */ 3004 copyWithin(target: number, start: number, end?: number): this; 3005 3006 /** 3007 * Determines whether all the members of an array satisfy the specified test. 3008 * @param predicate A function that accepts up to three arguments. The every method calls 3009 * the predicate function for each element in the array until the predicate returns a value 3010 * which is coercible to the Boolean value false, or until the end of the array. 3011 * @param thisArg An object to which the this keyword can refer in the predicate function. 3012 * If thisArg is omitted, undefined is used as the this value. 3013 */ 3014 every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; 3015 3016 /** 3017 * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array 3018 * @param value value to fill array section with 3019 * @param start index to start filling the array at. If start is negative, it is treated as 3020 * length+start where length is the length of the array. 3021 * @param end index to stop filling the array at. If end is negative, it is treated as 3022 * length+end. 3023 */ 3024 fill(value: number, start?: number, end?: number): this; 3025 3026 /** 3027 * Returns the elements of an array that meet the condition specified in a callback function. 3028 * @param predicate A function that accepts up to three arguments. The filter method calls 3029 * the predicate function one time for each element in the array. 3030 * @param thisArg An object to which the this keyword can refer in the predicate function. 3031 * If thisArg is omitted, undefined is used as the this value. 3032 */ 3033 filter(predicate: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; 3034 3035 /** 3036 * Returns the value of the first element in the array where predicate is true, and undefined 3037 * otherwise. 3038 * @param predicate find calls predicate once for each element of the array, in ascending 3039 * order, until it finds one where predicate returns true. If such an element is found, find 3040 * immediately returns that element value. Otherwise, find 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 find(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number | undefined; 3045 3046 /** 3047 * Returns the index of the first element in the array where predicate is true, and -1 3048 * otherwise. 3049 * @param predicate find calls predicate once for each element of the array, in ascending 3050 * order, until it finds one where predicate returns true. If such an element is found, 3051 * findIndex immediately returns that element index. Otherwise, findIndex returns -1. 3052 * @param thisArg If provided, it will be used as the this value for each invocation of 3053 * predicate. If it is not provided, undefined is used instead. 3054 */ 3055 findIndex(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number; 3056 3057 /** 3058 * Performs the specified action for each element in an array. 3059 * @param callbackfn A function that accepts up to three arguments. forEach calls the 3060 * callbackfn function one time for each element in the array. 3061 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 3062 * If thisArg is omitted, undefined is used as the this value. 3063 */ 3064 forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; 3065 3066 /** 3067 * Returns the index of the first occurrence of a value in an array. 3068 * @param searchElement The value to locate in the array. 3069 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 3070 * search starts at index 0. 3071 */ 3072 indexOf(searchElement: number, fromIndex?: number): number; 3073 3074 /** 3075 * Adds all the elements of an array separated by the specified separator string. 3076 * @param separator A string used to separate one element of an array from the next in the 3077 * resulting String. If omitted, the array elements are separated with a comma. 3078 */ 3079 join(separator?: string): string; 3080 3081 /** 3082 * Returns the index of the last occurrence of a value in an array. 3083 * @param searchElement The value to locate in the array. 3084 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 3085 * search starts at index 0. 3086 */ 3087 lastIndexOf(searchElement: number, fromIndex?: number): number; 3088 3089 /** 3090 * The length of the array. 3091 */ 3092 readonly length: number; 3093 3094 /** 3095 * Calls a defined callback function on each element of an array, and returns an array that 3096 * contains the results. 3097 * @param callbackfn A function that accepts up to three arguments. The map method calls the 3098 * callbackfn function one time for each element in the array. 3099 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 3100 * If thisArg is omitted, undefined is used as the this value. 3101 */ 3102 map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; 3103 3104 /** 3105 * Calls the specified callback function for all the elements in an array. The return value of 3106 * the callback function is the accumulated result, and is provided as an argument in the next 3107 * call to the callback function. 3108 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 3109 * callbackfn function one time for each element in the array. 3110 * @param initialValue If initialValue is specified, it is used as the initial value to start 3111 * the accumulation. The first call to the callbackfn function provides this value as an argument 3112 * instead of an array value. 3113 */ 3114 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; 3115 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; 3116 3117 /** 3118 * Calls the specified callback function for all the elements in an array. The return value of 3119 * the callback function is the accumulated result, and is provided as an argument in the next 3120 * call to the callback function. 3121 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 3122 * callbackfn function one time for each element in the array. 3123 * @param initialValue If initialValue is specified, it is used as the initial value to start 3124 * the accumulation. The first call to the callbackfn function provides this value as an argument 3125 * instead of an array value. 3126 */ 3127 reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; 3128 3129 /** 3130 * Calls the specified callback function for all the elements in an array, in descending order. 3131 * The return value of the callback function is the accumulated result, and is provided as an 3132 * argument in the next call to the callback function. 3133 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 3134 * the callbackfn function one time for each element in the array. 3135 * @param initialValue If initialValue is specified, it is used as the initial value to start 3136 * the accumulation. The first call to the callbackfn function provides this value as an 3137 * argument instead of an array value. 3138 */ 3139 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; 3140 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; 3141 3142 /** 3143 * Calls the specified callback function for all the elements in an array, in descending order. 3144 * The return value of the callback function is the accumulated result, and is provided as an 3145 * argument in the next call to the callback function. 3146 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 3147 * the callbackfn function one time for each element in the array. 3148 * @param initialValue If initialValue is specified, it is used as the initial value to start 3149 * the accumulation. The first call to the callbackfn function provides this value as an argument 3150 * instead of an array value. 3151 */ 3152 reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; 3153 3154 /** 3155 * Reverses the elements in an Array. 3156 */ 3157 reverse(): Uint16Array; 3158 3159 /** 3160 * Sets a value or an array of values. 3161 * @param array A typed or untyped array of values to set. 3162 * @param offset The index in the current array at which the values are to be written. 3163 */ 3164 set(array: ArrayLike<number>, offset?: number): void; 3165 3166 /** 3167 * Returns a section of an array. 3168 * @param start The beginning of the specified portion of the array. 3169 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 3170 */ 3171 slice(start?: number, end?: number): Uint16Array; 3172 3173 /** 3174 * Determines whether the specified callback function returns true for any element of an array. 3175 * @param predicate A function that accepts up to three arguments. The some method calls 3176 * the predicate function for each element in the array until the predicate returns a value 3177 * which is coercible to the Boolean value true, or until the end of the array. 3178 * @param thisArg An object to which the this keyword can refer in the predicate function. 3179 * If thisArg is omitted, undefined is used as the this value. 3180 */ 3181 some(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; 3182 3183 /** 3184 * Sorts an array. 3185 * @param compareFn Function used to determine the order of the elements. It is expected to return 3186 * a negative value if first argument is less than second argument, zero if they're equal and a positive 3187 * value otherwise. If omitted, the elements are sorted in ascending order. 3188 * ```ts 3189 * [11,2,22,1].sort((a, b) => a - b) 3190 * ``` 3191 */ 3192 sort(compareFn?: (a: number, b: number) => number): this; 3193 3194 /** 3195 * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements 3196 * at begin, inclusive, up to end, exclusive. 3197 * @param begin The index of the beginning of the array. 3198 * @param end The index of the end of the array. 3199 */ 3200 subarray(begin?: number, end?: number): Uint16Array; 3201 3202 /** 3203 * Converts a number to a string by using the current locale. 3204 */ 3205 toLocaleString(): string; 3206 3207 /** 3208 * Returns a string representation of an array. 3209 */ 3210 toString(): string; 3211 3212 /** Returns the primitive value of the specified object. */ 3213 valueOf(): Uint16Array; 3214 3215 [index: number]: number; 3216} 3217 3218interface Uint16ArrayConstructor { 3219 readonly prototype: Uint16Array; 3220 new(length: number): Uint16Array; 3221 new(array: ArrayLike<number> | ArrayBufferLike): Uint16Array; 3222 new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array; 3223 3224 /** 3225 * The size in bytes of each element in the array. 3226 */ 3227 readonly BYTES_PER_ELEMENT: number; 3228 3229 /** 3230 * Returns a new array from a set of elements. 3231 * @param items A set of elements to include in the new array object. 3232 */ 3233 of(...items: number[]): Uint16Array; 3234 3235 /** 3236 * Creates an array from an array-like or iterable object. 3237 * @param arrayLike An array-like or iterable object to convert to an array. 3238 */ 3239 from(arrayLike: ArrayLike<number>): Uint16Array; 3240 3241 /** 3242 * Creates an array from an array-like or iterable object. 3243 * @param arrayLike An array-like or iterable object to convert to an array. 3244 * @param mapfn A mapping function to call on every element of the array. 3245 * @param thisArg Value of 'this' used to invoke the mapfn. 3246 */ 3247 from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; 3248 3249 3250} 3251declare var Uint16Array: Uint16ArrayConstructor; 3252/** 3253 * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the 3254 * requested number of bytes could not be allocated an exception is raised. 3255 */ 3256interface Int32Array { 3257 /** 3258 * The size in bytes of each element in the array. 3259 */ 3260 readonly BYTES_PER_ELEMENT: number; 3261 3262 /** 3263 * The ArrayBuffer instance referenced by the array. 3264 */ 3265 readonly buffer: ArrayBufferLike; 3266 3267 /** 3268 * The length in bytes of the array. 3269 */ 3270 readonly byteLength: number; 3271 3272 /** 3273 * The offset in bytes of the array. 3274 */ 3275 readonly byteOffset: number; 3276 3277 /** 3278 * Returns the this object after copying a section of the array identified by start and end 3279 * to the same array starting at position target 3280 * @param target If target is negative, it is treated as length+target where length is the 3281 * length of the array. 3282 * @param start If start is negative, it is treated as length+start. If end is negative, it 3283 * is treated as length+end. 3284 * @param end If not specified, length of the this object is used as its default value. 3285 */ 3286 copyWithin(target: number, start: number, end?: number): this; 3287 3288 /** 3289 * Determines whether all the members of an array satisfy the specified test. 3290 * @param predicate A function that accepts up to three arguments. The every method calls 3291 * the predicate function for each element in the array until the predicate returns a value 3292 * which is coercible to the Boolean value false, or until the end of the array. 3293 * @param thisArg An object to which the this keyword can refer in the predicate function. 3294 * If thisArg is omitted, undefined is used as the this value. 3295 */ 3296 every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; 3297 3298 /** 3299 * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array 3300 * @param value value to fill array section with 3301 * @param start index to start filling the array at. If start is negative, it is treated as 3302 * length+start where length is the length of the array. 3303 * @param end index to stop filling the array at. If end is negative, it is treated as 3304 * length+end. 3305 */ 3306 fill(value: number, start?: number, end?: number): this; 3307 3308 /** 3309 * Returns the elements of an array that meet the condition specified in a callback function. 3310 * @param predicate A function that accepts up to three arguments. The filter method calls 3311 * the predicate function one time for each element in the array. 3312 * @param thisArg An object to which the this keyword can refer in the predicate function. 3313 * If thisArg is omitted, undefined is used as the this value. 3314 */ 3315 filter(predicate: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; 3316 3317 /** 3318 * Returns the value of the first element in the array where predicate is true, and undefined 3319 * otherwise. 3320 * @param predicate find calls predicate once for each element of the array, in ascending 3321 * order, until it finds one where predicate returns true. If such an element is found, find 3322 * immediately returns that element value. Otherwise, find returns undefined. 3323 * @param thisArg If provided, it will be used as the this value for each invocation of 3324 * predicate. If it is not provided, undefined is used instead. 3325 */ 3326 find(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number | undefined; 3327 3328 /** 3329 * Returns the index of the first element in the array where predicate is true, and -1 3330 * otherwise. 3331 * @param predicate find calls predicate once for each element of the array, in ascending 3332 * order, until it finds one where predicate returns true. If such an element is found, 3333 * findIndex immediately returns that element index. Otherwise, findIndex returns -1. 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 findIndex(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number; 3338 3339 /** 3340 * Performs the specified action for each element in an array. 3341 * @param callbackfn A function that accepts up to three arguments. forEach calls the 3342 * callbackfn function one time for each element in the array. 3343 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 3344 * If thisArg is omitted, undefined is used as the this value. 3345 */ 3346 forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; 3347 3348 /** 3349 * Returns the index of the first occurrence of a value in an array. 3350 * @param searchElement The value to locate in the array. 3351 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 3352 * search starts at index 0. 3353 */ 3354 indexOf(searchElement: number, fromIndex?: number): number; 3355 3356 /** 3357 * Adds all the elements of an array separated by the specified separator string. 3358 * @param separator A string used to separate one element of an array from the next in the 3359 * resulting String. If omitted, the array elements are separated with a comma. 3360 */ 3361 join(separator?: string): string; 3362 3363 /** 3364 * Returns the index of the last occurrence of a value in an array. 3365 * @param searchElement The value to locate in the array. 3366 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 3367 * search starts at index 0. 3368 */ 3369 lastIndexOf(searchElement: number, fromIndex?: number): number; 3370 3371 /** 3372 * The length of the array. 3373 */ 3374 readonly length: number; 3375 3376 /** 3377 * Calls a defined callback function on each element of an array, and returns an array that 3378 * contains the results. 3379 * @param callbackfn A function that accepts up to three arguments. The map method calls the 3380 * callbackfn function one time for each element in the array. 3381 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 3382 * If thisArg is omitted, undefined is used as the this value. 3383 */ 3384 map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; 3385 3386 /** 3387 * Calls the specified callback function for all the elements in an array. The return value of 3388 * the callback function is the accumulated result, and is provided as an argument in the next 3389 * call to the callback function. 3390 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 3391 * callbackfn function one time for each element in the array. 3392 * @param initialValue If initialValue is specified, it is used as the initial value to start 3393 * the accumulation. The first call to the callbackfn function provides this value as an argument 3394 * instead of an array value. 3395 */ 3396 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; 3397 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; 3398 3399 /** 3400 * Calls the specified callback function for all the elements in an array. The return value of 3401 * the callback function is the accumulated result, and is provided as an argument in the next 3402 * call to the callback function. 3403 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 3404 * callbackfn function one time for each element in the array. 3405 * @param initialValue If initialValue is specified, it is used as the initial value to start 3406 * the accumulation. The first call to the callbackfn function provides this value as an argument 3407 * instead of an array value. 3408 */ 3409 reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; 3410 3411 /** 3412 * Calls the specified callback function for all the elements in an array, in descending order. 3413 * The return value of the callback function is the accumulated result, and is provided as an 3414 * argument in the next call to the callback function. 3415 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 3416 * the callbackfn function one time for each element in the array. 3417 * @param initialValue If initialValue is specified, it is used as the initial value to start 3418 * the accumulation. The first call to the callbackfn function provides this value as an 3419 * argument instead of an array value. 3420 */ 3421 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; 3422 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; 3423 3424 /** 3425 * Calls the specified callback function for all the elements in an array, in descending order. 3426 * The return value of the callback function is the accumulated result, and is provided as an 3427 * argument in the next call to the callback function. 3428 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 3429 * the callbackfn function one time for each element in the array. 3430 * @param initialValue If initialValue is specified, it is used as the initial value to start 3431 * the accumulation. The first call to the callbackfn function provides this value as an argument 3432 * instead of an array value. 3433 */ 3434 reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; 3435 3436 /** 3437 * Reverses the elements in an Array. 3438 */ 3439 reverse(): Int32Array; 3440 3441 /** 3442 * Sets a value or an array of values. 3443 * @param array A typed or untyped array of values to set. 3444 * @param offset The index in the current array at which the values are to be written. 3445 */ 3446 set(array: ArrayLike<number>, offset?: number): void; 3447 3448 /** 3449 * Returns a section of an array. 3450 * @param start The beginning of the specified portion of the array. 3451 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 3452 */ 3453 slice(start?: number, end?: number): Int32Array; 3454 3455 /** 3456 * Determines whether the specified callback function returns true for any element of an array. 3457 * @param predicate A function that accepts up to three arguments. The some method calls 3458 * the predicate function for each element in the array until the predicate returns a value 3459 * which is coercible to the Boolean value true, or until the end of the array. 3460 * @param thisArg An object to which the this keyword can refer in the predicate function. 3461 * If thisArg is omitted, undefined is used as the this value. 3462 */ 3463 some(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; 3464 3465 /** 3466 * Sorts an array. 3467 * @param compareFn Function used to determine the order of the elements. It is expected to return 3468 * a negative value if first argument is less than second argument, zero if they're equal and a positive 3469 * value otherwise. If omitted, the elements are sorted in ascending order. 3470 * ```ts 3471 * [11,2,22,1].sort((a, b) => a - b) 3472 * ``` 3473 */ 3474 sort(compareFn?: (a: number, b: number) => number): this; 3475 3476 /** 3477 * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements 3478 * at begin, inclusive, up to end, exclusive. 3479 * @param begin The index of the beginning of the array. 3480 * @param end The index of the end of the array. 3481 */ 3482 subarray(begin?: number, end?: number): Int32Array; 3483 3484 /** 3485 * Converts a number to a string by using the current locale. 3486 */ 3487 toLocaleString(): string; 3488 3489 /** 3490 * Returns a string representation of an array. 3491 */ 3492 toString(): string; 3493 3494 /** Returns the primitive value of the specified object. */ 3495 valueOf(): Int32Array; 3496 3497 [index: number]: number; 3498} 3499 3500interface Int32ArrayConstructor { 3501 readonly prototype: Int32Array; 3502 new(length: number): Int32Array; 3503 new(array: ArrayLike<number> | ArrayBufferLike): Int32Array; 3504 new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array; 3505 3506 /** 3507 * The size in bytes of each element in the array. 3508 */ 3509 readonly BYTES_PER_ELEMENT: number; 3510 3511 /** 3512 * Returns a new array from a set of elements. 3513 * @param items A set of elements to include in the new array object. 3514 */ 3515 of(...items: number[]): Int32Array; 3516 3517 /** 3518 * Creates an array from an array-like or iterable object. 3519 * @param arrayLike An array-like or iterable object to convert to an array. 3520 */ 3521 from(arrayLike: ArrayLike<number>): Int32Array; 3522 3523 /** 3524 * Creates an array from an array-like or iterable object. 3525 * @param arrayLike An array-like or iterable object to convert to an array. 3526 * @param mapfn A mapping function to call on every element of the array. 3527 * @param thisArg Value of 'this' used to invoke the mapfn. 3528 */ 3529 from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; 3530 3531} 3532declare var Int32Array: Int32ArrayConstructor; 3533 3534/** 3535 * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the 3536 * requested number of bytes could not be allocated an exception is raised. 3537 */ 3538interface Uint32Array { 3539 /** 3540 * The size in bytes of each element in the array. 3541 */ 3542 readonly BYTES_PER_ELEMENT: number; 3543 3544 /** 3545 * The ArrayBuffer instance referenced by the array. 3546 */ 3547 readonly buffer: ArrayBufferLike; 3548 3549 /** 3550 * The length in bytes of the array. 3551 */ 3552 readonly byteLength: number; 3553 3554 /** 3555 * The offset in bytes of the array. 3556 */ 3557 readonly byteOffset: number; 3558 3559 /** 3560 * Returns the this object after copying a section of the array identified by start and end 3561 * to the same array starting at position target 3562 * @param target If target is negative, it is treated as length+target where length is the 3563 * length of the array. 3564 * @param start If start is negative, it is treated as length+start. If end is negative, it 3565 * is treated as length+end. 3566 * @param end If not specified, length of the this object is used as its default value. 3567 */ 3568 copyWithin(target: number, start: number, end?: number): this; 3569 3570 /** 3571 * Determines whether all the members of an array satisfy the specified test. 3572 * @param predicate A function that accepts up to three arguments. The every method calls 3573 * the predicate function for each element in the array until the predicate returns a value 3574 * which is coercible to the Boolean value false, or until the end of the array. 3575 * @param thisArg An object to which the this keyword can refer in the predicate function. 3576 * If thisArg is omitted, undefined is used as the this value. 3577 */ 3578 every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; 3579 3580 /** 3581 * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array 3582 * @param value value to fill array section with 3583 * @param start index to start filling the array at. If start is negative, it is treated as 3584 * length+start where length is the length of the array. 3585 * @param end index to stop filling the array at. If end is negative, it is treated as 3586 * length+end. 3587 */ 3588 fill(value: number, start?: number, end?: number): this; 3589 3590 /** 3591 * Returns the elements of an array that meet the condition specified in a callback function. 3592 * @param predicate A function that accepts up to three arguments. The filter method calls 3593 * the predicate function one time for each element in the array. 3594 * @param thisArg An object to which the this keyword can refer in the predicate function. 3595 * If thisArg is omitted, undefined is used as the this value. 3596 */ 3597 filter(predicate: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; 3598 3599 /** 3600 * Returns the value of the first element in the array where predicate is true, and undefined 3601 * otherwise. 3602 * @param predicate find calls predicate once for each element of the array, in ascending 3603 * order, until it finds one where predicate returns true. If such an element is found, find 3604 * immediately returns that element value. Otherwise, find returns undefined. 3605 * @param thisArg If provided, it will be used as the this value for each invocation of 3606 * predicate. If it is not provided, undefined is used instead. 3607 */ 3608 find(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number | undefined; 3609 3610 /** 3611 * Returns the index of the first element in the array where predicate is true, and -1 3612 * otherwise. 3613 * @param predicate find calls predicate once for each element of the array, in ascending 3614 * order, until it finds one where predicate returns true. If such an element is found, 3615 * findIndex immediately returns that element index. Otherwise, findIndex returns -1. 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 findIndex(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number; 3620 3621 /** 3622 * Performs the specified action for each element in an array. 3623 * @param callbackfn A function that accepts up to three arguments. forEach calls the 3624 * callbackfn function one time for each element in the array. 3625 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 3626 * If thisArg is omitted, undefined is used as the this value. 3627 */ 3628 forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; 3629 /** 3630 * Returns the index of the first occurrence of a value in an array. 3631 * @param searchElement The value to locate in the array. 3632 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 3633 * search starts at index 0. 3634 */ 3635 indexOf(searchElement: number, fromIndex?: number): number; 3636 3637 /** 3638 * Adds all the elements of an array separated by the specified separator string. 3639 * @param separator A string used to separate one element of an array from the next in the 3640 * resulting String. If omitted, the array elements are separated with a comma. 3641 */ 3642 join(separator?: string): string; 3643 3644 /** 3645 * Returns the index of the last occurrence of a value in an array. 3646 * @param searchElement The value to locate in the array. 3647 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 3648 * search starts at index 0. 3649 */ 3650 lastIndexOf(searchElement: number, fromIndex?: number): number; 3651 3652 /** 3653 * The length of the array. 3654 */ 3655 readonly length: number; 3656 3657 /** 3658 * Calls a defined callback function on each element of an array, and returns an array that 3659 * contains the results. 3660 * @param callbackfn A function that accepts up to three arguments. The map method calls the 3661 * callbackfn function one time for each element in the array. 3662 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 3663 * If thisArg is omitted, undefined is used as the this value. 3664 */ 3665 map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; 3666 3667 /** 3668 * Calls the specified callback function for all the elements in an array. The return value of 3669 * the callback function is the accumulated result, and is provided as an argument in the next 3670 * call to the callback function. 3671 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 3672 * callbackfn function one time for each element in the array. 3673 * @param initialValue If initialValue is specified, it is used as the initial value to start 3674 * the accumulation. The first call to the callbackfn function provides this value as an argument 3675 * instead of an array value. 3676 */ 3677 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; 3678 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; 3679 3680 /** 3681 * Calls the specified callback function for all the elements in an array. The return value of 3682 * the callback function is the accumulated result, and is provided as an argument in the next 3683 * call to the callback function. 3684 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 3685 * callbackfn function one time for each element in the array. 3686 * @param initialValue If initialValue is specified, it is used as the initial value to start 3687 * the accumulation. The first call to the callbackfn function provides this value as an argument 3688 * instead of an array value. 3689 */ 3690 reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; 3691 3692 /** 3693 * Calls the specified callback function for all the elements in an array, in descending order. 3694 * The return value of the callback function is the accumulated result, and is provided as an 3695 * argument in the next call to the callback function. 3696 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 3697 * the callbackfn function one time for each element in the array. 3698 * @param initialValue If initialValue is specified, it is used as the initial value to start 3699 * the accumulation. The first call to the callbackfn function provides this value as an 3700 * argument instead of an array value. 3701 */ 3702 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; 3703 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; 3704 3705 /** 3706 * Calls the specified callback function for all the elements in an array, in descending order. 3707 * The return value of the callback function is the accumulated result, and is provided as an 3708 * argument in the next call to the callback function. 3709 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 3710 * the callbackfn function one time for each element in the array. 3711 * @param initialValue If initialValue is specified, it is used as the initial value to start 3712 * the accumulation. The first call to the callbackfn function provides this value as an argument 3713 * instead of an array value. 3714 */ 3715 reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; 3716 3717 /** 3718 * Reverses the elements in an Array. 3719 */ 3720 reverse(): Uint32Array; 3721 3722 /** 3723 * Sets a value or an array of values. 3724 * @param array A typed or untyped array of values to set. 3725 * @param offset The index in the current array at which the values are to be written. 3726 */ 3727 set(array: ArrayLike<number>, offset?: number): void; 3728 3729 /** 3730 * Returns a section of an array. 3731 * @param start The beginning of the specified portion of the array. 3732 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 3733 */ 3734 slice(start?: number, end?: number): Uint32Array; 3735 3736 /** 3737 * Determines whether the specified callback function returns true for any element of an array. 3738 * @param predicate A function that accepts up to three arguments. The some method calls 3739 * the predicate function for each element in the array until the predicate returns a value 3740 * which is coercible to the Boolean value true, or until the end of the array. 3741 * @param thisArg An object to which the this keyword can refer in the predicate function. 3742 * If thisArg is omitted, undefined is used as the this value. 3743 */ 3744 some(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; 3745 3746 /** 3747 * Sorts an array. 3748 * @param compareFn Function used to determine the order of the elements. It is expected to return 3749 * a negative value if first argument is less than second argument, zero if they're equal and a positive 3750 * value otherwise. If omitted, the elements are sorted in ascending order. 3751 * ```ts 3752 * [11,2,22,1].sort((a, b) => a - b) 3753 * ``` 3754 */ 3755 sort(compareFn?: (a: number, b: number) => number): this; 3756 3757 /** 3758 * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements 3759 * at begin, inclusive, up to end, exclusive. 3760 * @param begin The index of the beginning of the array. 3761 * @param end The index of the end of the array. 3762 */ 3763 subarray(begin?: number, end?: number): Uint32Array; 3764 3765 /** 3766 * Converts a number to a string by using the current locale. 3767 */ 3768 toLocaleString(): string; 3769 3770 /** 3771 * Returns a string representation of an array. 3772 */ 3773 toString(): string; 3774 3775 /** Returns the primitive value of the specified object. */ 3776 valueOf(): Uint32Array; 3777 3778 [index: number]: number; 3779} 3780 3781interface Uint32ArrayConstructor { 3782 readonly prototype: Uint32Array; 3783 new(length: number): Uint32Array; 3784 new(array: ArrayLike<number> | ArrayBufferLike): Uint32Array; 3785 new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array; 3786 3787 /** 3788 * The size in bytes of each element in the array. 3789 */ 3790 readonly BYTES_PER_ELEMENT: number; 3791 3792 /** 3793 * Returns a new array from a set of elements. 3794 * @param items A set of elements to include in the new array object. 3795 */ 3796 of(...items: number[]): Uint32Array; 3797 3798 /** 3799 * Creates an array from an array-like or iterable object. 3800 * @param arrayLike An array-like or iterable object to convert to an array. 3801 */ 3802 from(arrayLike: ArrayLike<number>): Uint32Array; 3803 3804 /** 3805 * Creates an array from an array-like or iterable object. 3806 * @param arrayLike An array-like or iterable object to convert to an array. 3807 * @param mapfn A mapping function to call on every element of the array. 3808 * @param thisArg Value of 'this' used to invoke the mapfn. 3809 */ 3810 from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; 3811 3812} 3813declare var Uint32Array: Uint32ArrayConstructor; 3814 3815/** 3816 * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number 3817 * of bytes could not be allocated an exception is raised. 3818 */ 3819interface Float32Array { 3820 /** 3821 * The size in bytes of each element in the array. 3822 */ 3823 readonly BYTES_PER_ELEMENT: number; 3824 3825 /** 3826 * The ArrayBuffer instance referenced by the array. 3827 */ 3828 readonly buffer: ArrayBufferLike; 3829 3830 /** 3831 * The length in bytes of the array. 3832 */ 3833 readonly byteLength: number; 3834 3835 /** 3836 * The offset in bytes of the array. 3837 */ 3838 readonly byteOffset: number; 3839 3840 /** 3841 * Returns the this object after copying a section of the array identified by start and end 3842 * to the same array starting at position target 3843 * @param target If target is negative, it is treated as length+target where length is the 3844 * length of the array. 3845 * @param start If start is negative, it is treated as length+start. If end is negative, it 3846 * is treated as length+end. 3847 * @param end If not specified, length of the this object is used as its default value. 3848 */ 3849 copyWithin(target: number, start: number, end?: number): this; 3850 3851 /** 3852 * Determines whether all the members of an array satisfy the specified test. 3853 * @param predicate A function that accepts up to three arguments. The every method calls 3854 * the predicate function for each element in the array until the predicate returns a value 3855 * which is coercible to the Boolean value false, or until the end of the array. 3856 * @param thisArg An object to which the this keyword can refer in the predicate function. 3857 * If thisArg is omitted, undefined is used as the this value. 3858 */ 3859 every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; 3860 3861 /** 3862 * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array 3863 * @param value value to fill array section with 3864 * @param start index to start filling the array at. If start is negative, it is treated as 3865 * length+start where length is the length of the array. 3866 * @param end index to stop filling the array at. If end is negative, it is treated as 3867 * length+end. 3868 */ 3869 fill(value: number, start?: number, end?: number): this; 3870 3871 /** 3872 * Returns the elements of an array that meet the condition specified in a callback function. 3873 * @param predicate A function that accepts up to three arguments. The filter method calls 3874 * the predicate function one time for each element in the array. 3875 * @param thisArg An object to which the this keyword can refer in the predicate function. 3876 * If thisArg is omitted, undefined is used as the this value. 3877 */ 3878 filter(predicate: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; 3879 3880 /** 3881 * Returns the value of the first element in the array where predicate is true, and undefined 3882 * otherwise. 3883 * @param predicate find calls predicate once for each element of the array, in ascending 3884 * order, until it finds one where predicate returns true. If such an element is found, find 3885 * immediately returns that element value. Otherwise, find returns undefined. 3886 * @param thisArg If provided, it will be used as the this value for each invocation of 3887 * predicate. If it is not provided, undefined is used instead. 3888 */ 3889 find(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number | undefined; 3890 3891 /** 3892 * Returns the index of the first element in the array where predicate is true, and -1 3893 * otherwise. 3894 * @param predicate find calls predicate once for each element of the array, in ascending 3895 * order, until it finds one where predicate returns true. If such an element is found, 3896 * findIndex immediately returns that element index. Otherwise, findIndex returns -1. 3897 * @param thisArg If provided, it will be used as the this value for each invocation of 3898 * predicate. If it is not provided, undefined is used instead. 3899 */ 3900 findIndex(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number; 3901 3902 /** 3903 * Performs the specified action for each element in an array. 3904 * @param callbackfn A function that accepts up to three arguments. forEach calls the 3905 * callbackfn function one time for each element in the array. 3906 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 3907 * If thisArg is omitted, undefined is used as the this value. 3908 */ 3909 forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; 3910 3911 /** 3912 * Returns the index of the first occurrence of a value in an array. 3913 * @param searchElement The value to locate in the array. 3914 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 3915 * search starts at index 0. 3916 */ 3917 indexOf(searchElement: number, fromIndex?: number): number; 3918 3919 /** 3920 * Adds all the elements of an array separated by the specified separator string. 3921 * @param separator A string used to separate one element of an array from the next in the 3922 * resulting String. If omitted, the array elements are separated with a comma. 3923 */ 3924 join(separator?: string): string; 3925 3926 /** 3927 * Returns the index of the last occurrence of a value in an array. 3928 * @param searchElement The value to locate in the array. 3929 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 3930 * search starts at index 0. 3931 */ 3932 lastIndexOf(searchElement: number, fromIndex?: number): number; 3933 3934 /** 3935 * The length of the array. 3936 */ 3937 readonly length: number; 3938 3939 /** 3940 * Calls a defined callback function on each element of an array, and returns an array that 3941 * contains the results. 3942 * @param callbackfn A function that accepts up to three arguments. The map method calls the 3943 * callbackfn function one time for each element in the array. 3944 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 3945 * If thisArg is omitted, undefined is used as the this value. 3946 */ 3947 map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; 3948 3949 /** 3950 * Calls the specified callback function for all the elements in an array. The return value of 3951 * the callback function is the accumulated result, and is provided as an argument in the next 3952 * call to the callback function. 3953 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 3954 * callbackfn function one time for each element in the array. 3955 * @param initialValue If initialValue is specified, it is used as the initial value to start 3956 * the accumulation. The first call to the callbackfn function provides this value as an argument 3957 * instead of an array value. 3958 */ 3959 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; 3960 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; 3961 3962 /** 3963 * Calls the specified callback function for all the elements in an array. The return value of 3964 * the callback function is the accumulated result, and is provided as an argument in the next 3965 * call to the callback function. 3966 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 3967 * callbackfn function one time for each element in the array. 3968 * @param initialValue If initialValue is specified, it is used as the initial value to start 3969 * the accumulation. The first call to the callbackfn function provides this value as an argument 3970 * instead of an array value. 3971 */ 3972 reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; 3973 3974 /** 3975 * Calls the specified callback function for all the elements in an array, in descending order. 3976 * The return value of the callback function is the accumulated result, and is provided as an 3977 * argument in the next call to the callback function. 3978 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 3979 * the callbackfn function one time for each element in the array. 3980 * @param initialValue If initialValue is specified, it is used as the initial value to start 3981 * the accumulation. The first call to the callbackfn function provides this value as an 3982 * argument instead of an array value. 3983 */ 3984 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; 3985 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; 3986 3987 /** 3988 * Calls the specified callback function for all the elements in an array, in descending order. 3989 * The return value of the callback function is the accumulated result, and is provided as an 3990 * argument in the next call to the callback function. 3991 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 3992 * the callbackfn function one time for each element in the array. 3993 * @param initialValue If initialValue is specified, it is used as the initial value to start 3994 * the accumulation. The first call to the callbackfn function provides this value as an argument 3995 * instead of an array value. 3996 */ 3997 reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; 3998 3999 /** 4000 * Reverses the elements in an Array. 4001 */ 4002 reverse(): Float32Array; 4003 4004 /** 4005 * Sets a value or an array of values. 4006 * @param array A typed or untyped array of values to set. 4007 * @param offset The index in the current array at which the values are to be written. 4008 */ 4009 set(array: ArrayLike<number>, offset?: number): void; 4010 4011 /** 4012 * Returns a section of an array. 4013 * @param start The beginning of the specified portion of the array. 4014 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 4015 */ 4016 slice(start?: number, end?: number): Float32Array; 4017 4018 /** 4019 * Determines whether the specified callback function returns true for any element of an array. 4020 * @param predicate A function that accepts up to three arguments. The some method calls 4021 * the predicate function for each element in the array until the predicate returns a value 4022 * which is coercible to the Boolean value true, or until the end of the array. 4023 * @param thisArg An object to which the this keyword can refer in the predicate function. 4024 * If thisArg is omitted, undefined is used as the this value. 4025 */ 4026 some(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; 4027 4028 /** 4029 * Sorts an array. 4030 * @param compareFn Function used to determine the order of the elements. It is expected to return 4031 * a negative value if first argument is less than second argument, zero if they're equal and a positive 4032 * value otherwise. If omitted, the elements are sorted in ascending order. 4033 * ```ts 4034 * [11,2,22,1].sort((a, b) => a - b) 4035 * ``` 4036 */ 4037 sort(compareFn?: (a: number, b: number) => number): this; 4038 4039 /** 4040 * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements 4041 * at begin, inclusive, up to end, exclusive. 4042 * @param begin The index of the beginning of the array. 4043 * @param end The index of the end of the array. 4044 */ 4045 subarray(begin?: number, end?: number): Float32Array; 4046 4047 /** 4048 * Converts a number to a string by using the current locale. 4049 */ 4050 toLocaleString(): string; 4051 4052 /** 4053 * Returns a string representation of an array. 4054 */ 4055 toString(): string; 4056 4057 /** Returns the primitive value of the specified object. */ 4058 valueOf(): Float32Array; 4059 4060 [index: number]: number; 4061} 4062 4063interface Float32ArrayConstructor { 4064 readonly prototype: Float32Array; 4065 new(length: number): Float32Array; 4066 new(array: ArrayLike<number> | ArrayBufferLike): Float32Array; 4067 new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array; 4068 4069 /** 4070 * The size in bytes of each element in the array. 4071 */ 4072 readonly BYTES_PER_ELEMENT: number; 4073 4074 /** 4075 * Returns a new array from a set of elements. 4076 * @param items A set of elements to include in the new array object. 4077 */ 4078 of(...items: number[]): Float32Array; 4079 4080 /** 4081 * Creates an array from an array-like or iterable object. 4082 * @param arrayLike An array-like or iterable object to convert to an array. 4083 */ 4084 from(arrayLike: ArrayLike<number>): Float32Array; 4085 4086 /** 4087 * Creates an array from an array-like or iterable object. 4088 * @param arrayLike An array-like or iterable object to convert to an array. 4089 * @param mapfn A mapping function to call on every element of the array. 4090 * @param thisArg Value of 'this' used to invoke the mapfn. 4091 */ 4092 from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; 4093 4094 4095} 4096declare var Float32Array: Float32ArrayConstructor; 4097 4098/** 4099 * A typed array of 64-bit float values. The contents are initialized to 0. If the requested 4100 * number of bytes could not be allocated an exception is raised. 4101 */ 4102interface Float64Array { 4103 /** 4104 * The size in bytes of each element in the array. 4105 */ 4106 readonly BYTES_PER_ELEMENT: number; 4107 4108 /** 4109 * The ArrayBuffer instance referenced by the array. 4110 */ 4111 readonly buffer: ArrayBufferLike; 4112 4113 /** 4114 * The length in bytes of the array. 4115 */ 4116 readonly byteLength: number; 4117 4118 /** 4119 * The offset in bytes of the array. 4120 */ 4121 readonly byteOffset: number; 4122 4123 /** 4124 * Returns the this object after copying a section of the array identified by start and end 4125 * to the same array starting at position target 4126 * @param target If target is negative, it is treated as length+target where length is the 4127 * length of the array. 4128 * @param start If start is negative, it is treated as length+start. If end is negative, it 4129 * is treated as length+end. 4130 * @param end If not specified, length of the this object is used as its default value. 4131 */ 4132 copyWithin(target: number, start: number, end?: number): this; 4133 4134 /** 4135 * Determines whether all the members of an array satisfy the specified test. 4136 * @param predicate A function that accepts up to three arguments. The every method calls 4137 * the predicate function for each element in the array until the predicate returns a value 4138 * which is coercible to the Boolean value false, or until the end of the array. 4139 * @param thisArg An object to which the this keyword can refer in the predicate function. 4140 * If thisArg is omitted, undefined is used as the this value. 4141 */ 4142 every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; 4143 4144 /** 4145 * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array 4146 * @param value value to fill array section with 4147 * @param start index to start filling the array at. If start is negative, it is treated as 4148 * length+start where length is the length of the array. 4149 * @param end index to stop filling the array at. If end is negative, it is treated as 4150 * length+end. 4151 */ 4152 fill(value: number, start?: number, end?: number): this; 4153 4154 /** 4155 * Returns the elements of an array that meet the condition specified in a callback function. 4156 * @param predicate A function that accepts up to three arguments. The filter method calls 4157 * the predicate function one time for each element in the array. 4158 * @param thisArg An object to which the this keyword can refer in the predicate function. 4159 * If thisArg is omitted, undefined is used as the this value. 4160 */ 4161 filter(predicate: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; 4162 4163 /** 4164 * Returns the value of the first element in the array where predicate is true, and undefined 4165 * otherwise. 4166 * @param predicate find calls predicate once for each element of the array, in ascending 4167 * order, until it finds one where predicate returns true. If such an element is found, find 4168 * immediately returns that element value. Otherwise, find returns undefined. 4169 * @param thisArg If provided, it will be used as the this value for each invocation of 4170 * predicate. If it is not provided, undefined is used instead. 4171 */ 4172 find(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number | undefined; 4173 4174 /** 4175 * Returns the index of the first element in the array where predicate is true, and -1 4176 * otherwise. 4177 * @param predicate find calls predicate once for each element of the array, in ascending 4178 * order, until it finds one where predicate returns true. If such an element is found, 4179 * findIndex immediately returns that element index. Otherwise, findIndex returns -1. 4180 * @param thisArg If provided, it will be used as the this value for each invocation of 4181 * predicate. If it is not provided, undefined is used instead. 4182 */ 4183 findIndex(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number; 4184 4185 /** 4186 * Performs the specified action for each element in an array. 4187 * @param callbackfn A function that accepts up to three arguments. forEach calls the 4188 * callbackfn function one time for each element in the array. 4189 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 4190 * If thisArg is omitted, undefined is used as the this value. 4191 */ 4192 forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; 4193 4194 /** 4195 * Returns the index of the first occurrence of a value in an array. 4196 * @param searchElement The value to locate in the array. 4197 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 4198 * search starts at index 0. 4199 */ 4200 indexOf(searchElement: number, fromIndex?: number): number; 4201 4202 /** 4203 * Adds all the elements of an array separated by the specified separator string. 4204 * @param separator A string used to separate one element of an array from the next in the 4205 * resulting String. If omitted, the array elements are separated with a comma. 4206 */ 4207 join(separator?: string): string; 4208 4209 /** 4210 * Returns the index of the last occurrence of a value in an array. 4211 * @param searchElement The value to locate in the array. 4212 * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the 4213 * search starts at index 0. 4214 */ 4215 lastIndexOf(searchElement: number, fromIndex?: number): number; 4216 4217 /** 4218 * The length of the array. 4219 */ 4220 readonly length: number; 4221 4222 /** 4223 * Calls a defined callback function on each element of an array, and returns an array that 4224 * contains the results. 4225 * @param callbackfn A function that accepts up to three arguments. The map method calls the 4226 * callbackfn function one time for each element in the array. 4227 * @param thisArg An object to which the this keyword can refer in the callbackfn function. 4228 * If thisArg is omitted, undefined is used as the this value. 4229 */ 4230 map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; 4231 4232 /** 4233 * Calls the specified callback function for all the elements in an array. The return value of 4234 * the callback function is the accumulated result, and is provided as an argument in the next 4235 * call to the callback function. 4236 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 4237 * callbackfn function one time for each element in the array. 4238 * @param initialValue If initialValue is specified, it is used as the initial value to start 4239 * the accumulation. The first call to the callbackfn function provides this value as an argument 4240 * instead of an array value. 4241 */ 4242 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; 4243 reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; 4244 4245 /** 4246 * Calls the specified callback function for all the elements in an array. The return value of 4247 * the callback function is the accumulated result, and is provided as an argument in the next 4248 * call to the callback function. 4249 * @param callbackfn A function that accepts up to four arguments. The reduce method calls the 4250 * callbackfn function one time for each element in the array. 4251 * @param initialValue If initialValue is specified, it is used as the initial value to start 4252 * the accumulation. The first call to the callbackfn function provides this value as an argument 4253 * instead of an array value. 4254 */ 4255 reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; 4256 4257 /** 4258 * Calls the specified callback function for all the elements in an array, in descending order. 4259 * The return value of the callback function is the accumulated result, and is provided as an 4260 * argument in the next call to the callback function. 4261 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 4262 * the callbackfn function one time for each element in the array. 4263 * @param initialValue If initialValue is specified, it is used as the initial value to start 4264 * the accumulation. The first call to the callbackfn function provides this value as an 4265 * argument instead of an array value. 4266 */ 4267 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; 4268 reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; 4269 4270 /** 4271 * Calls the specified callback function for all the elements in an array, in descending order. 4272 * The return value of the callback function is the accumulated result, and is provided as an 4273 * argument in the next call to the callback function. 4274 * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls 4275 * the callbackfn function one time for each element in the array. 4276 * @param initialValue If initialValue is specified, it is used as the initial value to start 4277 * the accumulation. The first call to the callbackfn function provides this value as an argument 4278 * instead of an array value. 4279 */ 4280 reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; 4281 4282 /** 4283 * Reverses the elements in an Array. 4284 */ 4285 reverse(): Float64Array; 4286 4287 /** 4288 * Sets a value or an array of values. 4289 * @param array A typed or untyped array of values to set. 4290 * @param offset The index in the current array at which the values are to be written. 4291 */ 4292 set(array: ArrayLike<number>, offset?: number): void; 4293 4294 /** 4295 * Returns a section of an array. 4296 * @param start The beginning of the specified portion of the array. 4297 * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. 4298 */ 4299 slice(start?: number, end?: number): Float64Array; 4300 4301 /** 4302 * Determines whether the specified callback function returns true for any element of an array. 4303 * @param predicate A function that accepts up to three arguments. The some method calls 4304 * the predicate function for each element in the array until the predicate returns a value 4305 * which is coercible to the Boolean value true, or until the end of the array. 4306 * @param thisArg An object to which the this keyword can refer in the predicate function. 4307 * If thisArg is omitted, undefined is used as the this value. 4308 */ 4309 some(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; 4310 4311 /** 4312 * Sorts an array. 4313 * @param compareFn Function used to determine the order of the elements. It is expected to return 4314 * a negative value if first argument is less than second argument, zero if they're equal and a positive 4315 * value otherwise. If omitted, the elements are sorted in ascending order. 4316 * ```ts 4317 * [11,2,22,1].sort((a, b) => a - b) 4318 * ``` 4319 */ 4320 sort(compareFn?: (a: number, b: number) => number): this; 4321 4322 /** 4323 * at begin, inclusive, up to end, exclusive. 4324 * @param begin The index of the beginning of the array. 4325 * @param end The index of the end of the array. 4326 */ 4327 subarray(begin?: number, end?: number): Float64Array; 4328 4329 toString(): string; 4330 4331 /** Returns the primitive value of the specified object. */ 4332 valueOf(): Float64Array; 4333 4334 [index: number]: number; 4335} 4336 4337interface Float64ArrayConstructor { 4338 readonly prototype: Float64Array; 4339 new(length: number): Float64Array; 4340 new(array: ArrayLike<number> | ArrayBufferLike): Float64Array; 4341 new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array; 4342 4343 /** 4344 * The size in bytes of each element in the array. 4345 */ 4346 readonly BYTES_PER_ELEMENT: number; 4347 4348 /** 4349 * Returns a new array from a set of elements. 4350 * @param items A set of elements to include in the new array object. 4351 */ 4352 of(...items: number[]): Float64Array; 4353 4354 /** 4355 * Creates an array from an array-like or iterable object. 4356 * @param arrayLike An array-like or iterable object to convert to an array. 4357 */ 4358 from(arrayLike: ArrayLike<number>): Float64Array; 4359 4360 /** 4361 * Creates an array from an array-like or iterable object. 4362 * @param arrayLike An array-like or iterable object to convert to an array. 4363 * @param mapfn A mapping function to call on every element of the array. 4364 * @param thisArg Value of 'this' used to invoke the mapfn. 4365 */ 4366 from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; 4367 4368} 4369declare var Float64Array: Float64ArrayConstructor; 4370 4371///////////////////////////// 4372/// ECMAScript Internationalization API 4373///////////////////////////// 4374 4375declare namespace Intl { 4376 interface CollatorOptions { 4377 usage?: string | undefined; 4378 localeMatcher?: string | undefined; 4379 numeric?: boolean | undefined; 4380 caseFirst?: string | undefined; 4381 sensitivity?: string | undefined; 4382 ignorePunctuation?: boolean | undefined; 4383 } 4384 4385 interface ResolvedCollatorOptions { 4386 locale: string; 4387 usage: string; 4388 sensitivity: string; 4389 ignorePunctuation: boolean; 4390 collation: string; 4391 caseFirst: string; 4392 numeric: boolean; 4393 } 4394 4395 interface Collator { 4396 compare(x: string, y: string): number; 4397 resolvedOptions(): ResolvedCollatorOptions; 4398 } 4399 var Collator: { 4400 new(locales?: string | string[], options?: CollatorOptions): Collator; 4401 (locales?: string | string[], options?: CollatorOptions): Collator; 4402 supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; 4403 }; 4404 4405 interface NumberFormatOptions { 4406 localeMatcher?: string | undefined; 4407 style?: string | undefined; 4408 currency?: string | undefined; 4409 currencySign?: string | undefined; 4410 useGrouping?: boolean | undefined; 4411 minimumIntegerDigits?: number | undefined; 4412 minimumFractionDigits?: number | undefined; 4413 maximumFractionDigits?: number | undefined; 4414 minimumSignificantDigits?: number | undefined; 4415 maximumSignificantDigits?: number | undefined; 4416 } 4417 4418 interface ResolvedNumberFormatOptions { 4419 locale: string; 4420 numberingSystem: string; 4421 style: string; 4422 currency?: string; 4423 minimumIntegerDigits: number; 4424 minimumFractionDigits: number; 4425 maximumFractionDigits: number; 4426 minimumSignificantDigits?: number; 4427 maximumSignificantDigits?: number; 4428 useGrouping: boolean; 4429 } 4430 4431 interface NumberFormat { 4432 format(value: number): string; 4433 resolvedOptions(): ResolvedNumberFormatOptions; 4434 } 4435 var NumberFormat: { 4436 new(locales?: string | string[], options?: NumberFormatOptions): NumberFormat; 4437 (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; 4438 supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; 4439 readonly prototype: NumberFormat; 4440 }; 4441 4442 interface DateTimeFormatOptions { 4443 localeMatcher?: "best fit" | "lookup" | undefined; 4444 weekday?: "long" | "short" | "narrow" | undefined; 4445 era?: "long" | "short" | "narrow" | undefined; 4446 year?: "numeric" | "2-digit" | undefined; 4447 month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined; 4448 day?: "numeric" | "2-digit" | undefined; 4449 hour?: "numeric" | "2-digit" | undefined; 4450 minute?: "numeric" | "2-digit" | undefined; 4451 second?: "numeric" | "2-digit" | undefined; 4452 timeZoneName?: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | undefined; 4453 formatMatcher?: "best fit" | "basic" | undefined; 4454 hour12?: boolean | undefined; 4455 timeZone?: string | undefined; 4456 } 4457 4458 interface ResolvedDateTimeFormatOptions { 4459 locale: string; 4460 calendar: string; 4461 numberingSystem: string; 4462 timeZone: string; 4463 hour12?: boolean; 4464 weekday?: string; 4465 era?: string; 4466 year?: string; 4467 month?: string; 4468 day?: string; 4469 hour?: string; 4470 minute?: string; 4471 second?: string; 4472 timeZoneName?: string; 4473 } 4474 4475 interface DateTimeFormat { 4476 format(date?: Date | number): string; 4477 resolvedOptions(): ResolvedDateTimeFormatOptions; 4478 } 4479 var DateTimeFormat: { 4480 new(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; 4481 (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; 4482 supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; 4483 readonly prototype: DateTimeFormat; 4484 }; 4485} 4486 4487interface String { 4488 /** 4489 * Determines whether two strings are equivalent in the current or specified locale. 4490 * @param that String to compare to target string 4491 * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. 4492 * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. 4493 */ 4494 localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; 4495} 4496 4497interface Number { 4498 /** 4499 * Converts a number to a string by using the current or specified locale. 4500 * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. 4501 * @param options An object that contains one or more properties that specify comparison options. 4502 */ 4503 toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; 4504} 4505 4506interface Date { 4507 /** 4508 * Converts a date and time to a string by using the current or specified locale. 4509 * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. 4510 * @param options An object that contains one or more properties that specify comparison options. 4511 */ 4512 toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; 4513 /** 4514 * Converts a date to a string by using the current or specified locale. 4515 * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. 4516 * @param options An object that contains one or more properties that specify comparison options. 4517 */ 4518 toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; 4519 4520 /** 4521 * Converts a time to a string by using the current or specified locale. 4522 * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. 4523 * @param options An object that contains one or more properties that specify comparison options. 4524 */ 4525 toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; 4526} 4527 4528type ESObject = any; 4529