\r
/**\r
* Converts a string to an integer.\r
- * @param s A string to convert into a number.\r
- * @param radix A value between 2 and 36 that specifies the base of the number in numString.\r
+ * @param string A string to convert into a number.\r
+ * @param radix A value between 2 and 36 that specifies the base of the number in `string`.\r
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r
* All other strings are considered decimal.\r
*/\r
-declare function parseInt(s: string, radix?: number): number;\r
+declare function parseInt(string: string, radix?: number): number;\r
\r
/**\r
* Converts a string to a floating-point number.\r
\r
/**\r
* Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.\r
+ * @deprecated A legacy feature for browser compatibility\r
* @param string A string value\r
*/\r
declare function escape(string: string): string;\r
\r
/**\r
* Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.\r
+ * @deprecated A legacy feature for browser compatibility\r
* @param string A string value\r
*/\r
declare function unescape(string: string): string;\r
* @param p The property name.\r
* @param attributes Descriptor for the property. It can be for a data property or an accessor property.\r
*/\r
- defineProperty(o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): any;\r
+ defineProperty<T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): T;\r
\r
/**\r
* Adds one or more properties to an object, and/or modifies attributes of existing properties.\r
* @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object.\r
* @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.\r
*/\r
- defineProperties(o: any, properties: PropertyDescriptorMap & ThisType<any>): any;\r
+ defineProperties<T>(o: T, properties: PropertyDescriptorMap & ThisType<any>): T;\r
\r
/**\r
* Prevents the modification of attributes of existing properties, and prevents the addition of new properties.\r
\r
/**\r
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\r
- * @param o Object on which to lock the attributes.\r
+ * @param a Object on which to lock the attributes.\r
*/\r
freeze<T>(a: T[]): readonly T[];\r
\r
/**\r
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\r
- * @param o Object on which to lock the attributes.\r
+ * @param f Object on which to lock the attributes.\r
*/\r
freeze<T extends Function>(f: T): T;\r
\r
// IE extensions\r
/**\r
* Gets a substring beginning at the specified location and having the specified length.\r
+ * @deprecated A legacy feature for browser compatibility\r
* @param from The starting position of the desired substring. The index of the first character in the string is zero.\r
* @param length The number of characters to include in the returned substring.\r
*/\r
interface ImportMeta {\r
}\r
\r
+/**\r
+ * The type for the optional second argument to `import()`.\r
+ *\r
+ * If your host environment supports additional options, this type may be\r
+ * augmented via interface merging.\r
+ */\r
+interface ImportCallOptions {\r
+ assert?: ImportAssertions;\r
+}\r
+\r
+/**\r
+ * The type for the `assert` property of the optional second argument to `import()`.\r
+ */\r
+interface ImportAssertions {\r
+ [key: string]: string;\r
+}\r
+\r
interface Math {\r
/** The mathematical constant e. This is Euler's number, the base of natural logarithms. */\r
readonly E: number;\r
lastIndex: number;\r
\r
// Non-standard extensions\r
- compile(): this;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ compile(pattern: string, flags?: string): this;\r
}\r
\r
interface RegExpConstructor {\r
readonly prototype: RegExp;\r
\r
// Non-standard extensions\r
+ /** @deprecated A legacy feature for browser compatibility */\r
$1: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
$2: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
$3: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
$4: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
$5: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
$6: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
$7: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
$8: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
$9: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ input: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ $_: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
lastMatch: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ "$&": string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ lastParen: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ "$+": string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ leftContext: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ "$`": string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ rightContext: string;\r
+ /** @deprecated A legacy feature for browser compatibility */\r
+ "$'": string;\r
}\r
\r
declare var RegExp: RegExpConstructor;\r
*/\r
toString(): string;\r
/**\r
- * Returns a string representation of an array. The elements are converted to string using their toLocalString methods.\r
+ * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.\r
*/\r
toLocaleString(): string;\r
/**\r
*/\r
toString(): string;\r
/**\r
- * Returns a string representation of an array. The elements are converted to string using their toLocalString methods.\r
+ * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.\r
*/\r
toLocaleString(): string;\r
/**\r
* Sorts an array in place.\r
* This method mutates the array and returns a reference to the same array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
- * a negative value if first argument is less than second argument, zero if they're equal and a positive\r
+ * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive\r
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;\r
}\r
\r
+/**\r
+ * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`.\r
+ */\r
+type Awaited<T> =\r
+ T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode\r
+ T extends object & { then(onfulfilled: infer F): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped\r
+ F extends ((value: infer V) => any) ? // if the argument to `then` is callable, extracts the argument\r
+ Awaited<V> : // recursively unwrap the value\r
+ never : // the argument to `then` was not callable\r
+ T; // non-object or non-thenable\r
+\r
interface ArrayLike<T> {\r
readonly length: number;\r
readonly [n: number]: T;\r
/**\r
* Obtain the parameters of a constructor function type in a tuple\r
*/\r
-type ConstructorParameters<T extends new (...args: any) => any> = T extends new (...args: infer P) => any ? P : never;\r
+type ConstructorParameters<T extends abstract new (...args: any) => any> = T extends abstract new (...args: infer P) => any ? P : never;\r
\r
/**\r
* Obtain the return type of a function type\r
/**\r
* Obtain the return type of a constructor function type\r
*/\r
-type InstanceType<T extends new (...args: any) => any> = T extends new (...args: any) => infer R ? R : any;\r
+type InstanceType<T extends abstract new (...args: any) => any> = T extends abstract new (...args: any) => infer R ? R : any;\r
\r
/**\r
* Convert string literal type to uppercase\r
every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean;\r
\r
/**\r
- * Returns the this object after filling the section identified by start and end with value\r
+ * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array\r
* @param value value to fill array section with\r
* @param start index to start filling the array at. If start is negative, it is treated as\r
* length+start where length is the length of the array.\r
* Sorts an array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
* a negative value if first argument is less than second argument, zero if they're equal and a positive\r
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
+ * value otherwise. If omitted, the elements are sorted in ascending order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
* ```\r
every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean;\r
\r
/**\r
- * Returns the this object after filling the section identified by start and end with value\r
+ * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array\r
* @param value value to fill array section with\r
* @param start index to start filling the array at. If start is negative, it is treated as\r
* length+start where length is the length of the array.\r
* Sorts an array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
* a negative value if first argument is less than second argument, zero if they're equal and a positive\r
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
+ * value otherwise. If omitted, the elements are sorted in ascending order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
* ```\r
every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean;\r
\r
/**\r
- * Returns the this object after filling the section identified by start and end with value\r
+ * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array\r
* @param value value to fill array section with\r
* @param start index to start filling the array at. If start is negative, it is treated as\r
* length+start where length is the length of the array.\r
* Sorts an array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
* a negative value if first argument is less than second argument, zero if they're equal and a positive\r
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
+ * value otherwise. If omitted, the elements are sorted in ascending order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
* ```\r
every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean;\r
\r
/**\r
- * Returns the this object after filling the section identified by start and end with value\r
+ * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array\r
* @param value value to fill array section with\r
* @param start index to start filling the array at. If start is negative, it is treated as\r
* length+start where length is the length of the array.\r
* Sorts an array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
* a negative value if first argument is less than second argument, zero if they're equal and a positive\r
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
+ * value otherwise. If omitted, the elements are sorted in ascending order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
* ```\r
every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean;\r
\r
/**\r
- * Returns the this object after filling the section identified by start and end with value\r
+ * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array\r
* @param value value to fill array section with\r
* @param start index to start filling the array at. If start is negative, it is treated as\r
* length+start where length is the length of the array.\r
* Sorts an array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
* a negative value if first argument is less than second argument, zero if they're equal and a positive\r
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
+ * value otherwise. If omitted, the elements are sorted in ascending order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
* ```\r
every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean;\r
\r
/**\r
- * Returns the this object after filling the section identified by start and end with value\r
+ * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array\r
* @param value value to fill array section with\r
* @param start index to start filling the array at. If start is negative, it is treated as\r
* length+start where length is the length of the array.\r
* Sorts an array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
* a negative value if first argument is less than second argument, zero if they're equal and a positive\r
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
+ * value otherwise. If omitted, the elements are sorted in ascending order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
* ```\r
every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean;\r
\r
/**\r
- * Returns the this object after filling the section identified by start and end with value\r
+ * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array\r
* @param value value to fill array section with\r
* @param start index to start filling the array at. If start is negative, it is treated as\r
* length+start where length is the length of the array.\r
* Sorts an array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
* a negative value if first argument is less than second argument, zero if they're equal and a positive\r
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
+ * value otherwise. If omitted, the elements are sorted in ascending order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
* ```\r
every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean;\r
\r
/**\r
- * Returns the this object after filling the section identified by start and end with value\r
+ * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array\r
* @param value value to fill array section with\r
* @param start index to start filling the array at. If start is negative, it is treated as\r
* length+start where length is the length of the array.\r
* Sorts an array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
* a negative value if first argument is less than second argument, zero if they're equal and a positive\r
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
+ * value otherwise. If omitted, the elements are sorted in ascending order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
* ```\r
every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean;\r
\r
/**\r
- * Returns the this object after filling the section identified by start and end with value\r
+ * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array\r
* @param value value to fill array section with\r
* @param start index to start filling the array at. If start is negative, it is treated as\r
* length+start where length is the length of the array.\r
* Sorts an array.\r
* @param compareFn Function used to determine the order of the elements. It is expected to return\r
* a negative value if first argument is less than second argument, zero if they're equal and a positive\r
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r
+ * value otherwise. If omitted, the elements are sorted in ascending order.\r
* ```ts\r
* [11,2,22,1].sort((a, b) => a - b)\r
* ```\r
\r
declare namespace Intl {\r
interface CollatorOptions {\r
- usage?: string;\r
- localeMatcher?: string;\r
- numeric?: boolean;\r
- caseFirst?: string;\r
- sensitivity?: string;\r
- ignorePunctuation?: boolean;\r
+ usage?: string | undefined;\r
+ localeMatcher?: string | undefined;\r
+ numeric?: boolean | undefined;\r
+ caseFirst?: string | undefined;\r
+ sensitivity?: string | undefined;\r
+ ignorePunctuation?: boolean | undefined;\r
}\r
\r
interface ResolvedCollatorOptions {\r
};\r
\r
interface NumberFormatOptions {\r
- localeMatcher?: string;\r
- style?: string;\r
- currency?: string;\r
- currencyDisplay?: string;\r
- currencySign?: string;\r
- useGrouping?: boolean;\r
- minimumIntegerDigits?: number;\r
- minimumFractionDigits?: number;\r
- maximumFractionDigits?: number;\r
- minimumSignificantDigits?: number;\r
- maximumSignificantDigits?: number;\r
+ localeMatcher?: string | undefined;\r
+ style?: string | undefined;\r
+ currency?: string | undefined;\r
+ currencyDisplay?: string | undefined;\r
+ currencySign?: string | undefined;\r
+ useGrouping?: boolean | undefined;\r
+ minimumIntegerDigits?: number | undefined;\r
+ minimumFractionDigits?: number | undefined;\r
+ maximumFractionDigits?: number | undefined;\r
+ minimumSignificantDigits?: number | undefined;\r
+ maximumSignificantDigits?: number | undefined;\r
}\r
\r
interface ResolvedNumberFormatOptions {\r
};\r
\r
interface DateTimeFormatOptions {\r
- localeMatcher?: "best fit" | "lookup";\r
- weekday?: "long" | "short" | "narrow";\r
- era?: "long" | "short" | "narrow";\r
- year?: "numeric" | "2-digit";\r
- month?: "numeric" | "2-digit" | "long" | "short" | "narrow";\r
- day?: "numeric" | "2-digit";\r
- hour?: "numeric" | "2-digit";\r
- minute?: "numeric" | "2-digit";\r
- second?: "numeric" | "2-digit";\r
- timeZoneName?: "long" | "short";\r
- formatMatcher?: "best fit" | "basic";\r
- hour12?: boolean;\r
- timeZone?: string;\r
+ localeMatcher?: "best fit" | "lookup" | undefined;\r
+ weekday?: "long" | "short" | "narrow" | undefined;\r
+ era?: "long" | "short" | "narrow" | undefined;\r
+ year?: "numeric" | "2-digit" | undefined;\r
+ month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined;\r
+ day?: "numeric" | "2-digit" | undefined;\r
+ hour?: "numeric" | "2-digit" | undefined;\r
+ minute?: "numeric" | "2-digit" | undefined;\r
+ second?: "numeric" | "2-digit" | undefined;\r
+ timeZoneName?: "long" | "short" | undefined;\r
+ formatMatcher?: "best fit" | "basic" | undefined;\r
+ hour12?: boolean | undefined;\r
+ timeZone?: string | undefined;\r
}\r
\r
interface ResolvedDateTimeFormatOptions {\r