From 16e8eb74693cf5af7f5a68bf411d184f0b7605a1 Mon Sep 17 00:00:00 2001 From: graphemecluster Date: Thu, 16 Jun 2022 04:16:27 +0800 Subject: [PATCH 1/3] Major Improvements 2 --- build/alias.ts | 46 + build/logic/generate.ts | 117 +- docs/diff.md | 1 + docs/diff/es2015.collection.d.ts.md | 8 +- docs/diff/es2015.core.d.ts.md | 161 +- docs/diff/es2015.iterable.d.ts.md | 337 +- docs/diff/es2015.symbol.wellknown.d.ts.md | 18 +- docs/diff/es2017.object.d.ts.md | 21 +- docs/diff/es2020.bigint.d.ts.md | 636 ++++ docs/diff/es2022.object.d.ts.md | 6 +- docs/diff/es5.d.ts.md | 3304 +++++++++++++++++++- generated/lib.es2015.collection.d.ts | 8 +- generated/lib.es2015.core.d.ts | 145 +- generated/lib.es2015.iterable.d.ts | 247 +- generated/lib.es2015.symbol.wellknown.d.ts | 4 +- generated/lib.es2017.object.d.ts | 22 +- generated/lib.es2020.bigint.d.ts | 504 ++- generated/lib.es2022.object.d.ts | 4 +- generated/lib.es5.d.ts | 2733 ++++++++++------ lib/lib.es2015.collection.d.ts | 8 +- lib/lib.es2015.core.d.ts | 113 +- lib/lib.es2015.iterable.d.ts | 39 + lib/lib.es2017.object.d.ts | 15 +- lib/lib.es2020.bigint.d.ts | 203 ++ lib/lib.es5.d.ts | 424 ++- tests/src/es2015.core.ts | 20 +- tests/src/es2017.object.ts | 4 + tests/src/es2020.bigint.ts | 12 + tests/src/es5.ts | 83 +- 29 files changed, 7767 insertions(+), 1476 deletions(-) create mode 100644 build/alias.ts create mode 100644 docs/diff/es2020.bigint.d.ts.md create mode 100644 lib/lib.es2020.bigint.d.ts create mode 100644 tests/src/es2020.bigint.ts diff --git a/build/alias.ts b/build/alias.ts new file mode 100644 index 0000000..f7bbf6a --- /dev/null +++ b/build/alias.ts @@ -0,0 +1,46 @@ +const aliasArray: [string, string[]][] = [ + [ + "TypedNumberArray", + [ + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array", + ], + ], + ["TypedBigIntArray", ["BigInt64Array", "BigUint64Array"]], +]; + +export const alias = new Map( + aliasArray.flatMap(([originalType, replacementTypes]) => [ + [ + originalType, + new Map( + replacementTypes.map((replacement) => [ + replacement, + new Map([ + [originalType, replacement], + [`${originalType}Constructor`, `${replacement}Constructor`], + ]), + ]) + ), + ], + [ + `${originalType}Constructor`, + new Map( + replacementTypes.map((replacement) => [ + `${replacement}Constructor`, + new Map([ + [originalType, replacement], + [`${originalType}Constructor`, `${replacement}Constructor`], + ]), + ]) + ), + ], + ]) +); diff --git a/build/logic/generate.ts b/build/logic/generate.ts index 97c1e94..81457d1 100644 --- a/build/logic/generate.ts +++ b/build/logic/generate.ts @@ -1,5 +1,6 @@ import path from "path"; import ts from "typescript"; +import { alias } from "../alias"; import { upsert } from "../util/upsert"; import { projectDir } from "./projectDir"; @@ -24,7 +25,7 @@ export function generate( let result = ""; - const replacementTargets = scanBetterFile(libFile); + const replacementTargets = scanBetterFile(printer, libFile); if (replacementTargets.size === 0) { for (const statement of originalFile.statements) { @@ -188,7 +189,10 @@ type ReplacementTarget = ( /** * Scan better lib file to determine which statements need to be replaced. */ -function scanBetterFile(libFile: string): Map { +function scanBetterFile( + printer: ts.Printer, + libFile: string +): Map { const replacementTargets = new Map(); { const betterLibFile = path.join(betterLibDir, `lib.${libFile}`); @@ -198,43 +202,58 @@ function scanBetterFile(libFile: string): Map { // Scan better file to determine which statements need to be replaced. for (const statement of betterFile.statements) { const name = getStatementDeclName(statement) ?? ""; - if (ts.isInterfaceDeclaration(statement)) { - const members = new Map< - string, - { - member: ts.TypeElement; - text: string; - }[] - >(); - for (const member of statement.members) { - const memberName = member.name?.getText(betterFile) ?? ""; - upsert(members, memberName, (members = []) => { - members.push({ - member, - text: member.getFullText(betterFile), + const aliasesMap = + alias.get(name) ?? new Map([[name, new Map()]]); + for (const [targetName, typeMap] of aliasesMap) { + const transformedStatement = replaceAliases(statement, typeMap); + if (ts.isInterfaceDeclaration(transformedStatement)) { + const members = new Map< + string, + { + member: ts.TypeElement; + text: string; + }[] + >(); + for (const member of transformedStatement.members) { + const memberName = member.name?.getText(betterFile) ?? ""; + upsert(members, memberName, (members = []) => { + const leadingSpacesMatch = /^\s*/.exec( + member.getFullText(betterFile) + ); + const leadingSpaces = + leadingSpacesMatch !== null ? leadingSpacesMatch[0] : ""; + members.push({ + member, + text: + leadingSpaces + + printer.printNode( + ts.EmitHint.Unspecified, + member, + betterFile + ), + }); + return members; }); - return members; - }); - } - - upsert(replacementTargets, name, (targets = []) => { - targets.push({ - type: "interface", - members, - originalStatement: statement, - sourceFile: betterFile, + } + upsert(replacementTargets, targetName, (targets = []) => { + targets.push({ + type: "interface", + members, + originalStatement: transformedStatement, + sourceFile: betterFile, + }); + return targets; }); - return targets; - }); - } else { - upsert(replacementTargets, name, (statements = []) => { - statements.push({ - type: "non-interface", - statement, - sourceFile: betterFile, + } else { + upsert(replacementTargets, targetName, (statements = []) => { + statements.push({ + type: "non-interface", + statement: transformedStatement, + sourceFile: betterFile, + }); + return statements; }); - return statements; - }); + } } } } @@ -372,3 +391,29 @@ function commentOut(code: string): string { const result = lines.map((line) => `// ${line}`); return result.join("\n") + "\n"; } + +function replaceAliases( + statement: ts.Statement, + typeMap: Map +): ts.Statement { + if (typeMap.size === 0) return statement; + return ts.transform(statement, [ + (context) => (sourceStatement) => { + const visitor = (node: ts.Node): ts.Node => { + if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName)) { + const replacementType = typeMap.get(node.typeName.text); + if (replacementType === undefined) { + return node; + } + return ts.factory.updateTypeReferenceNode( + node, + ts.factory.createIdentifier(replacementType), + node.typeArguments + ); + } + return ts.visitEachChild(node, visitor, context); + }; + return ts.visitNode(sourceStatement, visitor); + }, + ]).transformed[0]; +} diff --git a/docs/diff.md b/docs/diff.md index 7824599..587f1e7 100644 --- a/docs/diff.md +++ b/docs/diff.md @@ -15,6 +15,7 @@ The following files are improved in better-typescript-lib: - [es2018.asyncgenerator.d.ts](./diff/es2018.asyncgenerator.d.ts.md) - [es2018.asynciterable.d.ts](./diff/es2018.asynciterable.d.ts.md) - [es2019.object.d.ts](./diff/es2019.object.d.ts.md) +- [es2020.bigint.d.ts](./diff/es2020.bigint.d.ts.md) - [es2021.promise.d.ts](./diff/es2021.promise.d.ts.md) - [es2021.string.d.ts](./diff/es2021.string.d.ts.md) - [es2022.object.d.ts](./diff/es2022.object.d.ts.md) diff --git a/docs/diff/es2015.collection.d.ts.md b/docs/diff/es2015.collection.d.ts.md index ffb1d5b..b023205 100644 --- a/docs/diff/es2015.collection.d.ts.md +++ b/docs/diff/es2015.collection.d.ts.md @@ -13,7 +13,7 @@ Index: es2015.collection.d.ts - callbackfn: (value: V, key: K, map: Map) => void, - thisArg?: any + forEach( -+ callbackfn: (this: This, value: V, key: K, map: Map) => void, ++ callbackfn: (this: This, value: V, key: K, map: this) => void, + thisArg?: This ): void; get(key: K): V | undefined; @@ -35,7 +35,7 @@ Index: es2015.collection.d.ts - callbackfn: (value: V, key: K, map: ReadonlyMap) => void, - thisArg?: any + forEach( -+ callbackfn: (this: This, value: V, key: K, map: ReadonlyMap) => void, ++ callbackfn: (this: This, value: V, key: K, map: this) => void, + thisArg?: This ): void; get(key: K): V | undefined; @@ -66,7 +66,7 @@ Index: es2015.collection.d.ts - callbackfn: (value: T, value2: T, set: Set) => void, - thisArg?: any + forEach( -+ callbackfn: (this: This, value: T, value2: T, set: Set) => void, ++ callbackfn: (this: This, value: T, value2: T, set: this) => void, + thisArg?: This ): void; has(value: T): boolean; @@ -86,7 +86,7 @@ Index: es2015.collection.d.ts - callbackfn: (value: T, value2: T, set: ReadonlySet) => void, - thisArg?: any + forEach( -+ callbackfn: (this: This, value: T, value2: T, set: ReadonlySet) => void, ++ callbackfn: (this: This, value: T, value2: T, set: this) => void, + thisArg?: This ): void; has(value: T): boolean; diff --git a/docs/diff/es2015.core.d.ts.md b/docs/diff/es2015.core.d.ts.md index 157bedb..d1aa0ea 100644 --- a/docs/diff/es2015.core.d.ts.md +++ b/docs/diff/es2015.core.d.ts.md @@ -5,7 +5,90 @@ Index: es2015.core.d.ts =================================================================== --- es2015.core.d.ts +++ es2015.core.d.ts -@@ -201,44 +201,42 @@ +@@ -7,15 +7,25 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (this: void, value: T, index: number, obj: T[]) => value is S, +- thisArg?: any ++ find( ++ predicate: (this: This, value: T, index: number, obj: this) => value is S, ++ thisArg?: This + ): S | undefined; +- find( +- predicate: (value: T, index: number, obj: T[]) => unknown, +- thisArg?: any ++ ++ /** ++ * Returns the value of the first element in the array where predicate is true, and undefined ++ * otherwise. ++ * @param predicate find calls predicate once for each element of the array, in ascending ++ * order, until it finds one where predicate returns true. If such an element is found, find ++ * immediately returns that element value. Otherwise, find returns undefined. ++ * @param thisArg If provided, it will be used as the this value for each invocation of ++ * predicate. If it is not provided, undefined is used instead. ++ */ ++ find( ++ predicate: (this: This, value: T, index: number, obj: this) => boolean, ++ thisArg?: This + ): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 +@@ -25,11 +35,11 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: T, index: number, obj: T[]) => unknown, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: T, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -51,26 +61,25 @@ + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + } +- + interface ArrayConstructor { + /** +- * Creates an array from an array-like object. +- * @param arrayLike An array-like object to convert to an array. ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): T[]; ++ from(source: ArrayLike): T[]; + + /** +- * Creates an array from an iterable object. +- * @param arrayLike An array-like object to convert to an array. ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => U, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => U, ++ thisArg?: This + ): U[]; + + /** + * Returns a new array from a set of elements. +@@ -201,44 +210,42 @@ * @param x A numeric expression. */ cbrt(x: number): number; @@ -54,7 +137,7 @@ Index: es2015.core.d.ts /** * The value of the largest integer n such that n and n + 1 are both exactly representable as * a Number value. -@@ -267,51 +265,21 @@ +@@ -267,51 +274,31 @@ * All other strings are considered decimal. */ parseInt(string: string, radix?: number): number; @@ -95,7 +178,17 @@ Index: es2015.core.d.ts - source3: W - ): T & U & V & W; + ...sources: Ts -+ ): First>; ++ ): CheckNonNullable< ++ T, ++ First< ++ UnionToIntersection< ++ | [T] ++ | { ++ [K in keyof Ts]: [Ts[K]]; ++ }[number] ++ > ++ > ++ >; /** - * Copy the values of all of the enumerable own properties from one or more source objects to a @@ -110,7 +203,7 @@ Index: es2015.core.d.ts * @param o Object to retrieve the symbols from. */ getOwnPropertySymbols(o: any): symbol[]; -@@ -326,16 +294,23 @@ +@@ -326,18 +313,24 @@ * Returns true if the values are the same value, false otherwise. * @param value1 The first value. * @param value2 The second value. @@ -133,10 +226,64 @@ Index: es2015.core.d.ts + */ + setPrototypeOf(o: T, proto: null): T; } - +- interface ReadonlyArray { /** -@@ -407,9 +382,8 @@ + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. +@@ -346,20 +339,25 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: ( +- this: void, +- value: T, +- index: number, +- obj: readonly T[] +- ) => value is S, +- thisArg?: any ++ find( ++ predicate: (this: This, value: T, index: number, obj: this) => value is S, ++ thisArg?: This + ): S | undefined; +- find( +- predicate: (value: T, index: number, obj: readonly T[]) => unknown, +- thisArg?: any ++ ++ /** ++ * Returns the value of the first element in the array where predicate is true, and undefined ++ * otherwise. ++ * @param predicate find calls predicate once for each element of the array, in ascending ++ * order, until it finds one where predicate returns true. If such an element is found, find ++ * immediately returns that element value. Otherwise, find returns undefined. ++ * @param thisArg If provided, it will be used as the this value for each invocation of ++ * predicate. If it is not provided, undefined is used instead. ++ */ ++ find( ++ predicate: (this: This, value: T, index: number, obj: this) => boolean, ++ thisArg?: This + ): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 +@@ -369,11 +367,11 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: T, index: number, obj: readonly T[]) => unknown, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: T, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; + } + + interface RegExp { +@@ -407,9 +405,8 @@ interface RegExpConstructor { new (pattern: RegExp | string, flags?: string): RegExp; (pattern: RegExp | string, flags?: string): RegExp; @@ -146,7 +293,7 @@ Index: es2015.core.d.ts /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point * value of the UTF-16 encoded code point starting at the string element at position pos in -@@ -433,26 +407,17 @@ +@@ -433,26 +430,17 @@ * same as the corresponding elements of this object (converted to a String) starting at * endPosition – length(this). Otherwise returns false. */ diff --git a/docs/diff/es2015.iterable.d.ts.md b/docs/diff/es2015.iterable.d.ts.md index 1663e56..a41372c 100644 --- a/docs/diff/es2015.iterable.d.ts.md +++ b/docs/diff/es2015.iterable.d.ts.md @@ -28,7 +28,43 @@ Index: es2015.iterable.d.ts } interface Array { -@@ -95,12 +94,11 @@ +@@ -55,26 +54,25 @@ + * Returns an iterable of values in the array + */ + values(): IterableIterator; + } +- + interface ArrayConstructor { + /** +- * Creates an array from an iterable object. +- * @param iterable An iterable object to convert to an array. ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(iterable: Iterable | ArrayLike): T[]; ++ from(source: Iterable | ArrayLike): T[]; + + /** +- * Creates an array from an iterable object. +- * @param iterable An iterable object to convert to an array. ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- iterable: Iterable | ArrayLike, +- mapfn: (v: T, k: number) => U, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => U, ++ thisArg?: This + ): U[]; + } + + interface ReadonlyArray { +@@ -95,12 +93,11 @@ * Returns an iterable of values in the array */ values(): IterableIterator; @@ -42,7 +78,7 @@ Index: es2015.iterable.d.ts interface Map { /** Returns an iterable of entries in the map. */ -@@ -140,11 +138,9 @@ +@@ -140,11 +137,9 @@ * Returns an iterable of values in the map */ values(): IterableIterator; @@ -54,7 +90,7 @@ Index: es2015.iterable.d.ts } interface WeakMap {} -@@ -201,25 +197,24 @@ +@@ -201,25 +196,24 @@ new (iterable: Iterable): WeakSet; } @@ -82,5 +118,300 @@ Index: es2015.iterable.d.ts interface String { /** Iterator */ +@@ -240,22 +234,25 @@ + * Returns an list of values in the array + */ + values(): IterableIterator; + } +- + interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. ++ */ ++ from(source: Iterable | ArrayLike): Int8Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: Iterable, +- mapfn?: (v: number, k: number) => number, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Int8Array; + } + + interface Uint8Array { +@@ -272,22 +269,25 @@ + * Returns an list of values in the array + */ + values(): IterableIterator; + } +- + interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. ++ */ ++ from(source: Iterable | ArrayLike): Uint8Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: Iterable, +- mapfn?: (v: number, k: number) => number, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Uint8Array; + } + + interface Uint8ClampedArray { +@@ -306,22 +306,25 @@ + * Returns an list of values in the array + */ + values(): IterableIterator; + } +- + interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. ++ */ ++ from(source: Iterable | ArrayLike): Uint8ClampedArray; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: Iterable, +- mapfn?: (v: number, k: number) => number, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Uint8ClampedArray; + } + + interface Int16Array { +@@ -340,22 +343,25 @@ + * Returns an list of values in the array + */ + values(): IterableIterator; + } +- + interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. ++ */ ++ from(source: Iterable | ArrayLike): Int16Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: Iterable, +- mapfn?: (v: number, k: number) => number, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Int16Array; + } + + interface Uint16Array { +@@ -372,22 +378,25 @@ + * Returns an list of values in the array + */ + values(): IterableIterator; + } +- + interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. ++ */ ++ from(source: Iterable | ArrayLike): Uint16Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: Iterable, +- mapfn?: (v: number, k: number) => number, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Uint16Array; + } + + interface Int32Array { +@@ -404,22 +413,25 @@ + * Returns an list of values in the array + */ + values(): IterableIterator; + } +- + interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. ++ */ ++ from(source: Iterable | ArrayLike): Int32Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: Iterable, +- mapfn?: (v: number, k: number) => number, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Int32Array; + } + + interface Uint32Array { +@@ -436,22 +448,25 @@ + * Returns an list of values in the array + */ + values(): IterableIterator; + } +- + interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. ++ */ ++ from(source: Iterable | ArrayLike): Uint32Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: Iterable, +- mapfn?: (v: number, k: number) => number, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Uint32Array; + } + + interface Float32Array { +@@ -468,22 +483,25 @@ + * Returns an list of values in the array + */ + values(): IterableIterator; + } +- + interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. ++ */ ++ from(source: Iterable | ArrayLike): Float32Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: Iterable, +- mapfn?: (v: number, k: number) => number, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Float32Array; + } + + interface Float64Array { +@@ -500,20 +518,23 @@ + * Returns an list of values in the array + */ + values(): IterableIterator; + } +- + interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. ++ */ ++ from(source: Iterable | ArrayLike): Float64Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: Iterable, +- mapfn?: (v: number, k: number) => number, +- thisArg?: any ++ from( ++ source: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Float64Array; + } ``` diff --git a/docs/diff/es2015.symbol.wellknown.d.ts.md b/docs/diff/es2015.symbol.wellknown.d.ts.md index 828033f..2e8f51d 100644 --- a/docs/diff/es2015.symbol.wellknown.d.ts.md +++ b/docs/diff/es2015.symbol.wellknown.d.ts.md @@ -5,7 +5,7 @@ Index: es2015.symbol.wellknown.d.ts =================================================================== --- es2015.symbol.wellknown.d.ts +++ es2015.symbol.wellknown.d.ts -@@ -69,23 +69,14 @@ +@@ -69,22 +69,15 @@ [Symbol.toPrimitive](hint: string): symbol; readonly [Symbol.toStringTag]: string; @@ -24,13 +24,13 @@ Index: es2015.symbol.wellknown.d.ts - findIndex: boolean; - keys: boolean; - values: boolean; -- }; -+ readonly [Symbol.unscopables]: { [key: PropertyKey]: boolean }; ++ readonly [Symbol.unscopables]: { ++ [key: PropertyKey]: boolean; + }; } interface Date { - /** -@@ -156,17 +147,15 @@ +@@ -156,17 +149,15 @@ interface PromiseConstructor { readonly [Symbol.species]: PromiseConstructor; @@ -48,7 +48,7 @@ Index: es2015.symbol.wellknown.d.ts * Replaces text in a string, using this regular expression. * @param string A String object or string literal whose contents matching against * this regular expression will be replaced -@@ -182,9 +171,14 @@ +@@ -182,9 +173,14 @@ * @param replacer A function that returns the replacement text. */ [Symbol.replace]( @@ -64,7 +64,7 @@ Index: es2015.symbol.wellknown.d.ts /** * Finds the position beginning first substring match in a regular expression search -@@ -211,9 +205,8 @@ +@@ -211,9 +207,8 @@ interface RegExpConstructor { readonly [Symbol.species]: RegExpConstructor; @@ -74,7 +74,7 @@ Index: es2015.symbol.wellknown.d.ts /** * Matches a string or an object that supports being matched against, and returns an array * containing the results of that search, or null if no matches are found. -@@ -221,12 +214,11 @@ +@@ -221,12 +216,11 @@ */ match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; @@ -88,7 +88,7 @@ Index: es2015.symbol.wellknown.d.ts */ replace( searchValue: { -@@ -243,12 +235,12 @@ +@@ -243,12 +237,12 @@ replace( searchValue: { [Symbol.replace]( diff --git a/docs/diff/es2017.object.d.ts.md b/docs/diff/es2017.object.d.ts.md index ecfce9d..2101f1f 100644 --- a/docs/diff/es2017.object.d.ts.md +++ b/docs/diff/es2017.object.d.ts.md @@ -5,7 +5,7 @@ Index: es2017.object.d.ts =================================================================== --- es2017.object.d.ts +++ es2017.object.d.ts -@@ -2,27 +2,35 @@ +@@ -2,34 +2,45 @@ /** * Returns an array of values of the enumerable properties of an object * @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. @@ -23,7 +23,7 @@ Index: es2017.object.d.ts + * Returns an array of values of the enumerable properties of an object + * @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. + */ -+ values(o: unknown): unknown[]; ++ values(o: T): CheckNonNullable; /** * Returns an array of key/values of the enumerable properties of an object @@ -42,10 +42,25 @@ Index: es2017.object.d.ts + * Returns an array of key/values of the enumerable properties of an object + * @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. + */ -+ entries(o: T): [string, unknown][]; ++ entries(o: T): CheckNonNullable; /** * Returns an object containing all own property descriptors of an object * @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. + */ +- getOwnPropertyDescriptors( +- o: T +- ): { [P in keyof T]: TypedPropertyDescriptor } & { +- [x: string]: PropertyDescriptor; +- }; ++ getOwnPropertyDescriptors(o: T): CheckNonNullable< ++ T, ++ { ++ [P in keyof T]: TypedPropertyDescriptor; ++ } & { ++ [x: string]: PropertyDescriptor; ++ } ++ >; + } ``` diff --git a/docs/diff/es2020.bigint.d.ts.md b/docs/diff/es2020.bigint.d.ts.md new file mode 100644 index 0000000..05b401f --- /dev/null +++ b/docs/diff/es2020.bigint.d.ts.md @@ -0,0 +1,636 @@ +# es2020.bigint.d.ts Diffs + +```diff +Index: es2020.bigint.d.ts +=================================================================== +--- es2020.bigint.d.ts ++++ es2020.bigint.d.ts +@@ -228,13 +228,8 @@ + asUintN(bits: number, int: bigint): bigint; + } + + declare var BigInt: BigIntConstructor; +- +-/** +- * A typed array of 64-bit signed integer values. The contents are initialized to 0. If the +- * requested number of bytes could not be allocated, an exception is raised. +- */ + interface BigInt64Array { + /** The size in bytes of each element in the array. */ + readonly BYTES_PER_ELEMENT: number; + +@@ -259,20 +254,24 @@ + copyWithin(target: number, start: number, end?: number): this; + + /** Yields index, value pairs for every entry in the array. */ + entries(): IterableIterator<[number, bigint]>; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns false, + * or until the end of the array. + * @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. + */ +- every( +- predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -282,21 +281,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: bigint, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: bigint, index: number, array: BigInt64Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): BigInt64Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -304,13 +306,17 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, +- thisArg?: any ++ find( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): bigint | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -318,23 +324,27 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: bigint, index: number, array: BigInt64Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: bigint, index: number, array: this) => void, ++ thisArg?: This + ): void; + + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. +@@ -370,41 +380,40 @@ + lastIndexOf(searchElement: bigint, fromIndex?: number): number; + + /** The length of the array. */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: bigint, index: number, array: BigInt64Array) => bigint, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => bigint, ++ thisArg?: This + ): BigInt64Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: bigint, ++ previousValue: bigint | U, + currentValue: bigint, + currentIndex: number, +- array: BigInt64Array +- ) => bigint +- ): bigint; +- ++ array: this ++ ) => U ++ ): bigint | U; + /** + * 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. +@@ -413,37 +422,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: bigint, + currentIndex: number, +- array: BigInt64Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: bigint, ++ previousValue: bigint | U, + currentValue: bigint, + currentIndex: number, +- array: BigInt64Array +- ) => bigint +- ): bigint; +- ++ array: this ++ ) => U ++ ): bigint | U; + /** + * 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. +@@ -452,14 +456,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: bigint, + currentIndex: number, +- array: BigInt64Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -478,20 +482,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): BigInt64Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls the + * predicate function for each element in the array until the predicate returns true, or until + * the end of the array. + * @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. + */ +- some( +- predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts the array. +@@ -524,9 +532,8 @@ + readonly [Symbol.toStringTag]: "BigInt64Array"; + + [index: number]: bigint; + } +- + interface BigInt64ArrayConstructor { + readonly prototype: BigInt64Array; + new (length?: number): BigInt64Array; + new (array: Iterable): BigInt64Array; +@@ -543,29 +550,27 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: bigint[]): BigInt64Array; +- + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. ++ */ ++ from(arrayLike: Iterable | ArrayLike): BigInt64Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from(arrayLike: ArrayLike): BigInt64Array; +- from( +- arrayLike: ArrayLike, +- mapfn: (v: U, k: number) => bigint, +- thisArg?: any ++ from( ++ arrayLike: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => bigint, ++ thisArg?: This + ): BigInt64Array; + } + + declare var BigInt64Array: BigInt64ArrayConstructor; +- +-/** +- * A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the +- * requested number of bytes could not be allocated, an exception is raised. +- */ + interface BigUint64Array { + /** The size in bytes of each element in the array. */ + readonly BYTES_PER_ELEMENT: number; + +@@ -590,20 +595,24 @@ + copyWithin(target: number, start: number, end?: number): this; + + /** Yields index, value pairs for every entry in the array. */ + entries(): IterableIterator<[number, bigint]>; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns false, + * or until the end of the array. + * @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. + */ +- every( +- predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -613,21 +622,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: bigint, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: bigint, index: number, array: BigUint64Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): BigUint64Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -635,13 +647,17 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, +- thisArg?: any ++ find( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): bigint | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -649,23 +665,27 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: bigint, index: number, array: BigUint64Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: bigint, index: number, array: this) => void, ++ thisArg?: This + ): void; + + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. +@@ -701,41 +721,40 @@ + lastIndexOf(searchElement: bigint, fromIndex?: number): number; + + /** The length of the array. */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: bigint, index: number, array: BigUint64Array) => bigint, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => bigint, ++ thisArg?: This + ): BigUint64Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: bigint, ++ previousValue: bigint | U, + currentValue: bigint, + currentIndex: number, +- array: BigUint64Array +- ) => bigint +- ): bigint; +- ++ array: this ++ ) => U ++ ): bigint | U; + /** + * 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. +@@ -744,37 +763,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: bigint, + currentIndex: number, +- array: BigUint64Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: bigint, ++ previousValue: bigint | U, + currentValue: bigint, + currentIndex: number, +- array: BigUint64Array +- ) => bigint +- ): bigint; +- ++ array: this ++ ) => U ++ ): bigint | U; + /** + * 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. +@@ -783,14 +797,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: bigint, + currentIndex: number, +- array: BigUint64Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -809,20 +823,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): BigUint64Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls the + * predicate function for each element in the array until the predicate returns true, or until + * the end of the array. + * @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. + */ +- some( +- predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: bigint, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts the array. +@@ -855,9 +873,8 @@ + readonly [Symbol.toStringTag]: "BigUint64Array"; + + [index: number]: bigint; + } +- + interface BigUint64ArrayConstructor { + readonly prototype: BigUint64Array; + new (length?: number): BigUint64Array; + new (array: Iterable): BigUint64Array; +@@ -874,20 +891,23 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: bigint[]): BigUint64Array; +- + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. ++ */ ++ from(arrayLike: Iterable | ArrayLike): BigUint64Array; ++ /** ++ * Creates an array from an array-like or iterable object. ++ * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from(arrayLike: ArrayLike): BigUint64Array; +- from( +- arrayLike: ArrayLike, +- mapfn: (v: U, k: number) => bigint, +- thisArg?: any ++ from( ++ arrayLike: Iterable | ArrayLike, ++ mapfn: (this: This, v: T, k: number) => bigint, ++ thisArg?: This + ): BigUint64Array; + } + + declare var BigUint64Array: BigUint64ArrayConstructor; + +``` diff --git a/docs/diff/es2022.object.d.ts.md b/docs/diff/es2022.object.d.ts.md index 7ce05f0..8e3470b 100644 --- a/docs/diff/es2022.object.d.ts.md +++ b/docs/diff/es2022.object.d.ts.md @@ -5,7 +5,7 @@ Index: es2022.object.d.ts =================================================================== --- es2022.object.d.ts +++ es2022.object.d.ts -@@ -3,6 +3,17 @@ +@@ -3,6 +3,19 @@ * Determines whether an object has a property with the specified name. * @param o An object. * @param v A property name. @@ -21,7 +21,9 @@ Index: es2022.object.d.ts + : symbol extends Key + ? {} + : Key extends PropertyKey -+ ? { [key in Key]: unknown } ++ ? { ++ [key in Key]: unknown; ++ } + : {}; } diff --git a/docs/diff/es5.d.ts.md b/docs/diff/es5.d.ts.md index 90635eb..0bb8464 100644 --- a/docs/diff/es5.d.ts.md +++ b/docs/diff/es5.d.ts.md @@ -26,7 +26,7 @@ Index: es5.d.ts /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ constructor: Function; -@@ -112,14 +111,23 @@ +@@ -112,14 +111,25 @@ toLocaleString(): string; /** Returns the primitive value of the specified object. */ @@ -46,13 +46,15 @@ Index: es5.d.ts + : symbol extends Key + ? {} + : Key extends PropertyKey -+ ? { [key in Key]: unknown } ++ ? { ++ [key in Key]: unknown; ++ } + : {}; /** * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. -@@ -131,22 +139,21 @@ +@@ -131,78 +141,147 @@ * @param v A property name. */ propertyIsEnumerable(v: PropertyKey): boolean; @@ -73,18 +75,29 @@ Index: es5.d.ts * @param o The object that references the prototype. */ - getPrototypeOf(o: any): any; -+ getPrototypeOf(o: any): unknown; ++ getPrototypeOf(o: T): CheckNonNullable; /** * Gets the own property descriptor of the specified object. * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. -@@ -162,47 +169,101 @@ + * @param o Object that contains the property. + * @param p Name of the property. + */ +- getOwnPropertyDescriptor( +- o: any, ++ getOwnPropertyDescriptor( ++ o: T, + p: PropertyKey +- ): PropertyDescriptor | undefined; ++ ): CheckNonNullable; + + /** * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ - getOwnPropertyNames(o: any): string[]; -+ getOwnPropertyNames(o: O): O extends undefined | null ? never : string[]; ++ getOwnPropertyNames(o: T): CheckNonNullable; /** * Creates an object that has the specified prototype or that has null prototype. @@ -112,9 +125,13 @@ Index: es5.d.ts + o: O, + properties: P & ThisType + ): { -+ [K in keyof (O & P)]: P[K] extends { value: infer V } ++ [K in keyof (O & P)]: P[K] extends { ++ value: infer V; ++ } + ? V -+ : P[K] extends { get: () => infer V } ++ : P[K] extends { ++ get: () => infer V; ++ } + ? V + : K extends keyof O + ? O[K] @@ -130,9 +147,13 @@ Index: es5.d.ts + o: null, + properties: P & ThisType + ): { -+ [K in keyof P]: P[K] extends { value: infer V } ++ [K in keyof P]: P[K] extends { ++ value: infer V; ++ } + ? V -+ : P[K] extends { get: () => infer V } ++ : P[K] extends { ++ get: () => infer V; ++ } + ? V + : unknown; + }; @@ -159,9 +180,13 @@ Index: es5.d.ts + ): O & + (P extends PropertyKey // required to make P distributive + ? { -+ [K in P]: D extends { value: infer V } ++ [K in P]: D extends { ++ value: infer V; ++ } + ? V -+ : D extends { get: () => infer V } ++ : D extends { ++ get: () => infer V; ++ } + ? V + : unknown; + } @@ -183,9 +208,13 @@ Index: es5.d.ts + o: O, + properties: P & ThisType + ): { -+ [K in keyof (O & P)]: P[K] extends { value: infer V } ++ [K in keyof (O & P)]: P[K] extends { ++ value: infer V; ++ } + ? V -+ : P[K] extends { get: () => infer V } ++ : P[K] extends { ++ get: () => infer V; ++ } + ? V + : K extends keyof O + ? O[K] @@ -195,7 +224,7 @@ Index: es5.d.ts /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. * @param o Object on which to lock the attributes. -@@ -326,9 +387,8 @@ +@@ -326,9 +405,8 @@ ? T : T extends (...args: infer A) => infer R ? (...args: A) => R @@ -205,7 +234,7 @@ Index: es5.d.ts /** * Calls the function with the specified object as the this value and the elements of specified array as the arguments. * @param thisArg The object to be used as the this object. -@@ -350,56 +410,32 @@ +@@ -350,49 +428,20 @@ this: (this: T, ...args: A) => R, thisArg: T, ...args: A @@ -259,20 +288,14 @@ Index: es5.d.ts /** * Calls the function with the specified object as the this value and the elements of specified array as the arguments. * @param thisArg The object to be used as the this object. -+ */ -+ apply(this: new () => T, thisArg: T): void; -+ -+ /** -+ * Calls the function with the specified object as the this value and the elements of specified array as the arguments. -+ * @param thisArg The object to be used as the this object. - * @param args An array of argument values to be passed to the function. - */ -- apply(this: new () => T, thisArg: T): void; - apply( +@@ -414,55 +463,25 @@ this: new (...args: A) => T, thisArg: T, - args: A -@@ -421,48 +457,19 @@ + ...args: A + ): void; +- + /** + * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg The object to be used as the this object. * @param args Arguments to bind to the parameters of the function. @@ -326,7 +349,7 @@ Index: es5.d.ts /** Returns a string representation of a string. */ toString(): string; -@@ -508,24 +515,28 @@ +@@ -508,24 +527,28 @@ * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ @@ -359,7 +382,7 @@ Index: es5.d.ts /** * Finds the first substring match in a regular expression search. -@@ -1177,9 +1188,8 @@ +@@ -1177,9 +1200,8 @@ readonly prototype: URIError; } @@ -369,7 +392,7 @@ Index: es5.d.ts /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. -@@ -1187,43 +1197,80 @@ +@@ -1187,43 +1209,80 @@ * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse( @@ -464,7 +487,7 @@ Index: es5.d.ts /** * Gets the length of the array. This is a number one higher than the highest element defined in an array. */ -@@ -1276,11 +1323,16 @@ +@@ -1276,23 +1335,25 @@ * which is coercible to the Boolean value false, or until the end of the array. * @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. @@ -472,19 +495,17 @@ Index: es5.d.ts - every( - predicate: (value: T, index: number, array: readonly T[]) => value is S, - thisArg?: any +- ): this is readonly S[]; + every( -+ predicate: ( -+ this: This, -+ value: T, -+ index: number, -+ array: readonly T[] -+ ) => value is S, ++ predicate: (this: This, value: T, index: number, array: this) => value is S, + thisArg?: This - ): this is readonly S[]; ++ ): this is { ++ [K in keyof this]: S; ++ }; /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls -@@ -1288,11 +1340,16 @@ + * the predicate function for each element in the array until the predicate returns a value * which is coercible to the Boolean value false, or until the end of the array. * @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. @@ -493,18 +514,13 @@ Index: es5.d.ts - predicate: (value: T, index: number, array: readonly T[]) => unknown, - thisArg?: any + every( -+ predicate: ( -+ this: This, -+ value: T, -+ index: number, -+ array: readonly T[] -+ ) => boolean, ++ predicate: (this: This, value: T, index: number, array: this) => boolean, + thisArg?: This ): boolean; /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls -@@ -1300,47 +1357,67 @@ +@@ -1300,117 +1361,99 @@ * which is coercible to the Boolean value true, or until the end of the array. * @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. @@ -513,12 +529,7 @@ Index: es5.d.ts - predicate: (value: T, index: number, array: readonly T[]) => unknown, - thisArg?: any + some( -+ predicate: ( -+ this: This, -+ value: T, -+ index: number, -+ array: readonly T[] -+ ) => boolean, ++ predicate: (this: This, value: T, index: number, array: this) => boolean, + thisArg?: This ): boolean; /** @@ -530,12 +541,7 @@ Index: es5.d.ts - callbackfn: (value: T, index: number, array: readonly T[]) => void, - thisArg?: any + forEach( -+ callbackfn: ( -+ this: This, -+ value: T, -+ index: number, -+ array: readonly T[] -+ ) => void, ++ callbackfn: (this: This, value: T, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -546,10 +552,13 @@ Index: es5.d.ts - map( - callbackfn: (value: T, index: number, array: readonly T[]) => U, - thisArg?: any +- ): U[]; + map( -+ callbackfn: (this: This, value: T, index: number, array: readonly T[]) => U, ++ callbackfn: (this: This, value: T, index: number, array: this) => U, + thisArg?: This - ): U[]; ++ ): { ++ -readonly [K in keyof this]: U; ++ }; /** * Returns the elements of an array that meet the condition specified in a callback function. * @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. @@ -559,12 +568,7 @@ Index: es5.d.ts - predicate: (value: T, index: number, array: readonly T[]) => value is S, - thisArg?: any + filter( -+ predicate: ( -+ this: This, -+ value: T, -+ index: number, -+ array: readonly T[] -+ ) => value is S, ++ predicate: (this: This, value: T, index: number, array: this) => value is S, + thisArg?: This ): S[]; /** @@ -576,18 +580,97 @@ Index: es5.d.ts - predicate: (value: T, index: number, array: readonly T[]) => unknown, - thisArg?: any + filter( -+ predicate: ( -+ this: This, -+ value: T, -+ index: number, -+ array: readonly T[] -+ ) => boolean, ++ predicate: (this: This, value: T, index: number, array: this) => boolean, + thisArg?: This ): T[]; /** * 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. * @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. -@@ -1422,9 +1499,8 @@ +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: T, ++ previousValue: T | U, + currentValue: T, + currentIndex: number, +- array: readonly T[] +- ) => T +- ): T; +- reduce( +- callbackfn: ( +- previousValue: T, +- currentValue: T, +- currentIndex: number, +- array: readonly T[] +- ) => T, +- initialValue: T +- ): T; ++ array: this ++ ) => U ++ ): T | U; + /** + * 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. + * @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. + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, +- array: readonly T[] ++ array: this + ) => U, + initialValue: U + ): U; + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: T, ++ previousValue: T | U, + currentValue: T, + currentIndex: number, +- array: readonly T[] +- ) => T +- ): T; +- reduceRight( +- callbackfn: ( +- previousValue: T, +- currentValue: T, +- currentIndex: number, +- array: readonly T[] +- ) => T, +- initialValue: T +- ): T; ++ array: this ++ ) => U ++ ): T | U; + /** + * 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. + * @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. + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, +- array: readonly T[] ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -1422,9 +1465,8 @@ readonly [n: number]: T; join(separator?: string): string; slice(start?: number, end?: number): T[]; @@ -597,27 +680,7 @@ Index: es5.d.ts /** * Gets or sets the length of the array. This is a number one higher than the highest index in the array. */ -@@ -1500,17 +1576,17 @@ - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @returns An array containing the elements that were deleted. - */ -- splice(start: number, deleteCount?: number): T[]; -+ splice(start: number, deleteCount?: number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - * @returns An array containing the elements that were deleted. - */ -- splice(start: number, deleteCount: number, ...items: T[]): T[]; -+ splice(start: number, deleteCount: number, ...items: T[]): this; - /** - * Inserts new elements at the start of an array, and returns the new length of the array. - * @param items Elements to insert at the start of the array. - */ -@@ -1534,11 +1610,11 @@ +@@ -1534,23 +1576,25 @@ * which is coercible to the Boolean value false, or until the end of the array. * @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. @@ -625,14 +688,17 @@ Index: es5.d.ts - every( - predicate: (value: T, index: number, array: T[]) => value is S, - thisArg?: any +- ): this is S[]; + every( -+ predicate: (this: This, value: T, index: number, array: T[]) => value is S, ++ predicate: (this: This, value: T, index: number, array: this) => value is S, + thisArg?: This - ): this is S[]; ++ ): this is { ++ [K in keyof this]: S; ++ }; /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls -@@ -1546,11 +1622,11 @@ + * the predicate function for each element in the array until the predicate returns a value * which is coercible to the Boolean value false, or until the end of the array. * @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. @@ -641,13 +707,13 @@ Index: es5.d.ts - predicate: (value: T, index: number, array: T[]) => unknown, - thisArg?: any + every( -+ predicate: (this: This, value: T, index: number, array: T[]) => boolean, ++ predicate: (this: This, value: T, index: number, array: this) => boolean, + thisArg?: This ): boolean; /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls -@@ -1558,47 +1634,47 @@ +@@ -1558,133 +1602,112 @@ * which is coercible to the Boolean value true, or until the end of the array. * @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. @@ -656,7 +722,7 @@ Index: es5.d.ts - predicate: (value: T, index: number, array: T[]) => unknown, - thisArg?: any + some( -+ predicate: (this: This, value: T, index: number, array: T[]) => boolean, ++ predicate: (this: This, value: T, index: number, array: this) => boolean, + thisArg?: This ): boolean; /** @@ -668,7 +734,7 @@ Index: es5.d.ts - callbackfn: (value: T, index: number, array: T[]) => void, - thisArg?: any + forEach( -+ callbackfn: (this: This, value: T, index: number, array: T[]) => void, ++ callbackfn: (this: This, value: T, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -679,10 +745,13 @@ Index: es5.d.ts - map( - callbackfn: (value: T, index: number, array: T[]) => U, - thisArg?: any +- ): U[]; + map( -+ callbackfn: (this: This, value: T, index: number, array: T[]) => U, ++ callbackfn: (this: This, value: T, index: number, array: this) => U, + thisArg?: This - ): U[]; ++ ): { ++ [K in keyof this]: U; ++ }; /** * Returns the elements of an array that meet the condition specified in a callback function. * @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. @@ -692,7 +761,7 @@ Index: es5.d.ts - predicate: (value: T, index: number, array: T[]) => value is S, - thisArg?: any + filter( -+ predicate: (this: This, value: T, index: number, array: T[]) => value is S, ++ predicate: (this: This, value: T, index: number, array: this) => value is S, + thisArg?: This ): S[]; /** @@ -704,13 +773,94 @@ Index: es5.d.ts - predicate: (value: T, index: number, array: T[]) => unknown, - thisArg?: any + filter( -+ predicate: (this: This, value: T, index: number, array: T[]) => boolean, ++ predicate: (this: This, value: T, index: number, array: this) => boolean, + thisArg?: This ): T[]; /** * 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. * @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. -@@ -1673,18 +1749,15 @@ +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: T, ++ previousValue: T | U, + currentValue: T, + currentIndex: number, +- array: T[] +- ) => T +- ): T; +- reduce( +- callbackfn: ( +- previousValue: T, +- currentValue: T, +- currentIndex: number, +- array: T[] +- ) => T, +- initialValue: T +- ): T; ++ array: this ++ ) => U ++ ): T | U; + /** + * 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. + * @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. + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, +- array: T[] ++ array: this + ) => U, + initialValue: U + ): U; + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: T, ++ previousValue: T | U, + currentValue: T, + currentIndex: number, +- array: T[] +- ) => T +- ): T; +- reduceRight( +- callbackfn: ( +- previousValue: T, +- currentValue: T, +- currentIndex: number, +- array: T[] +- ) => T, +- initialValue: T +- ): T; ++ array: this ++ ) => U ++ ): T | U; + /** + * 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. + * @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. + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, +- array: T[] ++ array: this + ) => U, + initialValue: U ): U; [n: number]: T; @@ -731,7 +881,7 @@ Index: es5.d.ts declare var Array: ArrayConstructor; -@@ -1716,9 +1789,15 @@ +@@ -1716,9 +1739,15 @@ ) => void; declare type PromiseConstructorLike = new ( @@ -748,29 +898,2929 @@ Index: es5.d.ts ) => void ) => PromiseLike; -@@ -5434,9 +5513,8 @@ - options?: DateTimeFormatOptions - ): string[]; - }; +@@ -2087,13 +2116,8 @@ + byteLength?: number + ): DataView; } + declare var DataView: DataViewConstructor; - - interface String { +-/** +- * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested +- * number of bytes could not be allocated an exception is raised. +- */ + interface Int8Array { /** - * Determines whether two strings are equivalent in the current or specified locale. - * @param that String to compare to target string -@@ -5491,4 +5569,22 @@ - locales?: string | string[], - options?: Intl.DateTimeFormatOptions - ): string; + * The size in bytes of each element in the array. + */ +@@ -2123,20 +2147,24 @@ + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ +- every( +- predicate: (value: number, index: number, array: Int8Array) => unknown, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -2146,21 +2174,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: number, index: number, array: Int8Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): Int8Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -2168,13 +2199,12 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: number, index: number, obj: Int8Array) => boolean, +- thisArg?: any ++ find( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -2182,23 +2212,22 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: number, index: number, obj: Int8Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: number, index: number, array: Int8Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: number, index: number, array: this) => void, ++ thisArg?: This + ): void; + + /** + * Returns the index of the first occurrence of a value in an array. +@@ -2226,50 +2255,40 @@ + /** + * The length of the array. + */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: number, index: number, array: Int8Array) => number, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => number, ++ thisArg?: This + ): Int8Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Int8Array +- ) => number +- ): number; +- reduce( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Int8Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -2278,46 +2297,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Int8Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Int8Array +- ) => number +- ): number; +- reduceRight( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Int8Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -2326,14 +2331,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Int8Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -2354,20 +2359,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Int8Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ +- some( +- predicate: (value: number, index: number, array: Int8Array) => unknown, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts an array. +@@ -2422,33 +2431,26 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): Int8Array; +- ++ from(source: ArrayLike): Int8Array; + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => number, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Int8Array; } -+// -------------------- -+type First = T extends [any] ? T[0] : unknown; -+ -+type UnionToIntersection = ( -+ T extends any ? (arg: T) => void : never -+) extends (arg: infer F) => void -+ ? F -+ : unknown; + declare var Int8Array: Int8ArrayConstructor; +- +-/** +- * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the +- * requested number of bytes could not be allocated an exception is raised. +- */ + interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ +@@ -2478,20 +2480,24 @@ + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ +- every( +- predicate: (value: number, index: number, array: Uint8Array) => unknown, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -2501,21 +2507,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: number, index: number, array: Uint8Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): Uint8Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -2523,13 +2532,12 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: number, index: number, obj: Uint8Array) => boolean, +- thisArg?: any ++ find( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -2537,23 +2545,22 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: number, index: number, obj: Uint8Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: number, index: number, array: Uint8Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: number, index: number, array: this) => void, ++ thisArg?: This + ): void; + + /** + * Returns the index of the first occurrence of a value in an array. +@@ -2581,50 +2588,40 @@ + /** + * The length of the array. + */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: number, index: number, array: Uint8Array) => number, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => number, ++ thisArg?: This + ): Uint8Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Uint8Array +- ) => number +- ): number; +- reduce( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Uint8Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -2633,46 +2630,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Uint8Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Uint8Array +- ) => number +- ): number; +- reduceRight( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Uint8Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -2681,14 +2664,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Uint8Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -2709,20 +2692,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint8Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ +- some( +- predicate: (value: number, index: number, array: Uint8Array) => unknown, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts an array. +@@ -2757,9 +2744,8 @@ + valueOf(): Uint8Array; + + [index: number]: number; + } +- + interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike | ArrayBufferLike): Uint8Array; +@@ -2778,33 +2764,26 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): Uint8Array; +- ++ from(source: ArrayLike): Uint8Array; + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => number, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Uint8Array; + } + declare var Uint8Array: Uint8ArrayConstructor; +- +-/** +- * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. +- * If the requested number of bytes could not be allocated an exception is raised. +- */ + interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ +@@ -2834,24 +2813,24 @@ + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ +- every( ++ every( + predicate: ( ++ this: This, + value: number, + index: number, +- array: Uint8ClampedArray +- ) => unknown, +- thisArg?: any ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -2861,21 +2840,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: number, index: number, array: Uint8ClampedArray) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): Uint8ClampedArray; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -2883,17 +2865,12 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: ( +- value: number, +- index: number, +- obj: Uint8ClampedArray +- ) => boolean, +- thisArg?: any ++ find( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -2901,31 +2878,22 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: ( +- value: number, +- index: number, +- obj: Uint8ClampedArray +- ) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: ( +- value: number, +- index: number, +- array: Uint8ClampedArray +- ) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: number, index: number, array: this) => void, ++ thisArg?: This + ): void; + + /** + * Returns the index of the first occurrence of a value in an array. +@@ -2953,54 +2921,40 @@ + /** + * The length of the array. + */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( ++ map( + callbackfn: ( ++ this: This, + value: number, + index: number, +- array: Uint8ClampedArray ++ array: this + ) => number, +- thisArg?: any ++ thisArg?: This + ): Uint8ClampedArray; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Uint8ClampedArray +- ) => number +- ): number; +- reduce( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Uint8ClampedArray +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -3009,46 +2963,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Uint8ClampedArray ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Uint8ClampedArray +- ) => number +- ): number; +- reduceRight( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Uint8ClampedArray +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -3057,14 +2997,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Uint8ClampedArray ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -3085,24 +3025,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint8ClampedArray; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ +- some( ++ some( + predicate: ( ++ this: This, + value: number, + index: number, +- array: Uint8ClampedArray +- ) => unknown, +- thisArg?: any ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts an array. +@@ -3137,9 +3077,8 @@ + valueOf(): Uint8ClampedArray; + + [index: number]: number; + } +- + interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; +@@ -3158,33 +3097,26 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): Uint8ClampedArray; +- ++ from(source: ArrayLike): Uint8ClampedArray; + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => number, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Uint8ClampedArray; + } + declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; +- +-/** +- * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the +- * requested number of bytes could not be allocated an exception is raised. +- */ + interface Int16Array { + /** + * The size in bytes of each element in the array. + */ +@@ -3214,20 +3146,24 @@ + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ +- every( +- predicate: (value: number, index: number, array: Int16Array) => unknown, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -3237,21 +3173,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: number, index: number, array: Int16Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): Int16Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -3259,13 +3198,12 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: number, index: number, obj: Int16Array) => boolean, +- thisArg?: any ++ find( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -3273,23 +3211,22 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: number, index: number, obj: Int16Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: number, index: number, array: Int16Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: number, index: number, array: this) => void, ++ thisArg?: This + ): void; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. +@@ -3316,50 +3253,40 @@ + /** + * The length of the array. + */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: number, index: number, array: Int16Array) => number, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => number, ++ thisArg?: This + ): Int16Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Int16Array +- ) => number +- ): number; +- reduce( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Int16Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -3368,46 +3295,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Int16Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Int16Array +- ) => number +- ): number; +- reduceRight( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Int16Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -3416,14 +3329,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Int16Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -3444,20 +3357,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Int16Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ +- some( +- predicate: (value: number, index: number, array: Int16Array) => unknown, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts an array. +@@ -3492,9 +3409,8 @@ + valueOf(): Int16Array; + + [index: number]: number; + } +- + interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike | ArrayBufferLike): Int16Array; +@@ -3513,33 +3429,26 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): Int16Array; +- ++ from(source: ArrayLike): Int16Array; + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => number, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Int16Array; + } + declare var Int16Array: Int16ArrayConstructor; +- +-/** +- * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the +- * requested number of bytes could not be allocated an exception is raised. +- */ + interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ +@@ -3569,20 +3478,24 @@ + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ +- every( +- predicate: (value: number, index: number, array: Uint16Array) => unknown, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -3592,21 +3505,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: number, index: number, array: Uint16Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): Uint16Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -3614,13 +3530,12 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: number, index: number, obj: Uint16Array) => boolean, +- thisArg?: any ++ find( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -3628,23 +3543,22 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: number, index: number, obj: Uint16Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: number, index: number, array: Uint16Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: number, index: number, array: this) => void, ++ thisArg?: This + ): void; + + /** + * Returns the index of the first occurrence of a value in an array. +@@ -3672,50 +3586,40 @@ + /** + * The length of the array. + */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: number, index: number, array: Uint16Array) => number, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => number, ++ thisArg?: This + ): Uint16Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Uint16Array +- ) => number +- ): number; +- reduce( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Uint16Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -3724,46 +3628,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Uint16Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Uint16Array +- ) => number +- ): number; +- reduceRight( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Uint16Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -3772,14 +3662,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Uint16Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -3800,20 +3690,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint16Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ +- some( +- predicate: (value: number, index: number, array: Uint16Array) => unknown, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts an array. +@@ -3848,9 +3742,8 @@ + valueOf(): Uint16Array; + + [index: number]: number; + } +- + interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike | ArrayBufferLike): Uint16Array; +@@ -3869,32 +3762,26 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): Uint16Array; +- ++ from(source: ArrayLike): Uint16Array; + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => number, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Uint16Array; + } + declare var Uint16Array: Uint16ArrayConstructor; +-/** +- * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the +- * requested number of bytes could not be allocated an exception is raised. +- */ + interface Int32Array { + /** + * The size in bytes of each element in the array. + */ +@@ -3924,20 +3811,24 @@ + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ +- every( +- predicate: (value: number, index: number, array: Int32Array) => unknown, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -3947,21 +3838,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: number, index: number, array: Int32Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): Int32Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -3969,13 +3863,12 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: number, index: number, obj: Int32Array) => boolean, +- thisArg?: any ++ find( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -3983,23 +3876,22 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: number, index: number, obj: Int32Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: number, index: number, array: Int32Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: number, index: number, array: this) => void, ++ thisArg?: This + ): void; + + /** + * Returns the index of the first occurrence of a value in an array. +@@ -4027,50 +3919,40 @@ + /** + * The length of the array. + */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: number, index: number, array: Int32Array) => number, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => number, ++ thisArg?: This + ): Int32Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Int32Array +- ) => number +- ): number; +- reduce( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Int32Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -4079,46 +3961,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Int32Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Int32Array +- ) => number +- ): number; +- reduceRight( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Int32Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -4127,14 +3995,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Int32Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -4155,20 +4023,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Int32Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ +- some( +- predicate: (value: number, index: number, array: Int32Array) => unknown, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts an array. +@@ -4203,9 +4075,8 @@ + valueOf(): Int32Array; + + [index: number]: number; + } +- + interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike | ArrayBufferLike): Int32Array; +@@ -4224,33 +4095,26 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): Int32Array; +- ++ from(source: ArrayLike): Int32Array; + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => number, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Int32Array; + } + declare var Int32Array: Int32ArrayConstructor; +- +-/** +- * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the +- * requested number of bytes could not be allocated an exception is raised. +- */ + interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ +@@ -4280,20 +4144,24 @@ + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ +- every( +- predicate: (value: number, index: number, array: Uint32Array) => unknown, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -4303,21 +4171,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: number, index: number, array: Uint32Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): Uint32Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -4325,13 +4196,12 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: number, index: number, obj: Uint32Array) => boolean, +- thisArg?: any ++ find( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -4339,23 +4209,22 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: number, index: number, obj: Uint32Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: number, index: number, array: Uint32Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: number, index: number, array: this) => void, ++ thisArg?: This + ): void; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. +@@ -4382,50 +4251,40 @@ + /** + * The length of the array. + */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: number, index: number, array: Uint32Array) => number, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => number, ++ thisArg?: This + ): Uint32Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Uint32Array +- ) => number +- ): number; +- reduce( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Uint32Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -4434,46 +4293,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Uint32Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Uint32Array +- ) => number +- ): number; +- reduceRight( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Uint32Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -4482,14 +4327,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Uint32Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -4510,20 +4355,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint32Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ +- some( +- predicate: (value: number, index: number, array: Uint32Array) => unknown, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts an array. +@@ -4558,9 +4407,8 @@ + valueOf(): Uint32Array; + + [index: number]: number; + } +- + interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike | ArrayBufferLike): Uint32Array; +@@ -4579,33 +4427,26 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): Uint32Array; +- ++ from(source: ArrayLike): Uint32Array; + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => number, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Uint32Array; + } + declare var Uint32Array: Uint32ArrayConstructor; +- +-/** +- * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number +- * of bytes could not be allocated an exception is raised. +- */ + interface Float32Array { + /** + * The size in bytes of each element in the array. + */ +@@ -4635,20 +4476,24 @@ + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ +- every( +- predicate: (value: number, index: number, array: Float32Array) => unknown, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -4658,21 +4503,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: number, index: number, array: Float32Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): Float32Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -4680,13 +4528,12 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: number, index: number, obj: Float32Array) => boolean, +- thisArg?: any ++ find( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -4694,23 +4541,22 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: number, index: number, obj: Float32Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: number, index: number, array: Float32Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: number, index: number, array: this) => void, ++ thisArg?: This + ): void; + + /** + * Returns the index of the first occurrence of a value in an array. +@@ -4738,50 +4584,40 @@ + /** + * The length of the array. + */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: number, index: number, array: Float32Array) => number, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => number, ++ thisArg?: This + ): Float32Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Float32Array +- ) => number +- ): number; +- reduce( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Float32Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -4790,46 +4626,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Float32Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Float32Array +- ) => number +- ): number; +- reduceRight( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Float32Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -4838,14 +4660,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Float32Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -4866,20 +4688,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Float32Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ +- some( +- predicate: (value: number, index: number, array: Float32Array) => unknown, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts an array. +@@ -4914,9 +4740,8 @@ + valueOf(): Float32Array; + + [index: number]: number; + } +- + interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike | ArrayBufferLike): Float32Array; +@@ -4935,33 +4760,26 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): Float32Array; +- ++ from(source: ArrayLike): Float32Array; + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => number, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Float32Array; + } + declare var Float32Array: Float32ArrayConstructor; +- +-/** +- * A typed array of 64-bit float values. The contents are initialized to 0. If the requested +- * number of bytes could not be allocated an exception is raised. +- */ + interface Float64Array { + /** + * The size in bytes of each element in the array. + */ +@@ -4991,20 +4809,24 @@ + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +- + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ +- every( +- predicate: (value: number, index: number, array: Float64Array) => unknown, +- thisArg?: any ++ every( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +@@ -5014,21 +4836,24 @@ + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; +- + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ +- filter( +- predicate: (value: number, index: number, array: Float64Array) => any, +- thisArg?: any ++ filter( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): Float64Array; +- + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -5036,13 +4861,12 @@ + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- find( +- predicate: (value: number, index: number, obj: Float64Array) => boolean, +- thisArg?: any ++ find( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number | undefined; +- + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending +@@ -5050,23 +4874,22 @@ + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ +- findIndex( +- predicate: (value: number, index: number, obj: Float64Array) => boolean, +- thisArg?: any ++ findIndex( ++ predicate: (this: This, value: number, index: number, obj: this) => boolean, ++ thisArg?: This + ): number; +- + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ +- forEach( +- callbackfn: (value: number, index: number, array: Float64Array) => void, +- thisArg?: any ++ forEach( ++ callbackfn: (this: This, value: number, index: number, array: this) => void, ++ thisArg?: This + ): void; + + /** + * Returns the index of the first occurrence of a value in an array. +@@ -5094,50 +4917,40 @@ + /** + * The length of the array. + */ + readonly length: number; +- + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ +- map( +- callbackfn: (value: number, index: number, array: Float64Array) => number, +- thisArg?: any ++ map( ++ callbackfn: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => number, ++ thisArg?: This + ): Float64Array; +- + /** + * 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. + * @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. +- * @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. + */ +- reduce( ++ reduce( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Float64Array +- ) => number +- ): number; +- reduce( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Float64Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -5146,46 +4959,32 @@ + * @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. + */ +- reduce( ++ reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Float64Array ++ array: this + ) => U, + initialValue: U + ): U; +- + /** + * 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. + * @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. +- * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( +- previousValue: number, ++ previousValue: number | U, + currentValue: number, + currentIndex: number, +- array: Float64Array +- ) => number +- ): number; +- reduceRight( +- callbackfn: ( +- previousValue: number, +- currentValue: number, +- currentIndex: number, +- array: Float64Array +- ) => number, +- initialValue: number +- ): number; +- ++ array: this ++ ) => U ++ ): number | U; + /** + * 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. +@@ -5194,14 +4993,14 @@ + * @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. + */ +- reduceRight( ++ reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, +- array: Float64Array ++ array: this + ) => U, + initialValue: U + ): U; + +@@ -5222,20 +5021,24 @@ + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Float64Array; +- + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ +- some( +- predicate: (value: number, index: number, array: Float64Array) => unknown, +- thisArg?: any ++ some( ++ predicate: ( ++ this: This, ++ value: number, ++ index: number, ++ array: this ++ ) => boolean, ++ thisArg?: This + ): boolean; + + /** + * Sorts an array. +@@ -5261,9 +5064,8 @@ + valueOf(): Float64Array; + + [index: number]: number; + } +- + interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike | ArrayBufferLike): Float64Array; +@@ -5282,25 +5084,23 @@ + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; +- + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + */ +- from(arrayLike: ArrayLike): Float64Array; +- ++ from(source: ArrayLike): Float64Array; + /** + * Creates an array from an array-like or iterable object. +- * @param arrayLike An array-like or iterable object to convert to an array. ++ * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ +- from( +- arrayLike: ArrayLike, +- mapfn: (v: T, k: number) => number, +- thisArg?: any ++ from( ++ source: ArrayLike, ++ mapfn: (this: This, v: T, k: number) => number, ++ thisArg?: This + ): Float64Array; + } + declare var Float64Array: Float64ArrayConstructor; + +@@ -5434,9 +5234,8 @@ + options?: DateTimeFormatOptions + ): string[]; + }; + } +- + interface String { + /** + * Determines whether two strings are equivalent in the current or specified locale. + * @param that String to compare to target string +@@ -5491,4 +5290,24 @@ + locales?: string | string[], + options?: Intl.DateTimeFormatOptions + ): string; + } ++// -------------------- ++type First = T extends [any] ? T[0] : unknown; ++ ++type UnionToIntersection = ( ++ T extends any ? (arg: T) => void : never ++) extends (arg: infer F) => void ++ ? F ++ : unknown; ++ ++type CheckNonNullable = [T] extends [NonNullable] ? U : never; + +type JSONValue = + | null diff --git a/generated/lib.es2015.collection.d.ts b/generated/lib.es2015.collection.d.ts index 017b597..2f7b76e 100644 --- a/generated/lib.es2015.collection.d.ts +++ b/generated/lib.es2015.collection.d.ts @@ -2,7 +2,7 @@ interface Map { clear(): void; delete(key: K): boolean; forEach( - callbackfn: (this: This, value: V, key: K, map: Map) => void, + callbackfn: (this: This, value: V, key: K, map: this) => void, thisArg?: This ): void; get(key: K): V | undefined; @@ -23,7 +23,7 @@ interface MapConstructor { declare var Map: MapConstructor; interface ReadonlyMap { forEach( - callbackfn: (this: This, value: V, key: K, map: ReadonlyMap) => void, + callbackfn: (this: This, value: V, key: K, map: this) => void, thisArg?: This ): void; get(key: K): V | undefined; @@ -53,7 +53,7 @@ interface Set { clear(): void; delete(value: T): boolean; forEach( - callbackfn: (this: This, value: T, value2: T, set: Set) => void, + callbackfn: (this: This, value: T, value2: T, set: this) => void, thisArg?: This ): void; has(value: T): boolean; @@ -71,7 +71,7 @@ interface SetConstructor { declare var Set: SetConstructor; interface ReadonlySet { forEach( - callbackfn: (this: This, value: T, value2: T, set: ReadonlySet) => void, + callbackfn: (this: This, value: T, value2: T, set: this) => void, thisArg?: This ): void; has(value: T): boolean; diff --git a/generated/lib.es2015.core.d.ts b/generated/lib.es2015.core.d.ts index cec806c..c682c37 100644 --- a/generated/lib.es2015.core.d.ts +++ b/generated/lib.es2015.core.d.ts @@ -8,13 +8,23 @@ interface Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (this: void, value: T, index: number, obj: T[]) => value is S, - thisArg?: any + find( + predicate: (this: This, value: T, index: number, obj: this) => value is S, + thisArg?: This ): S | undefined; - find( - predicate: (value: T, index: number, obj: T[]) => unknown, - thisArg?: any + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find( + predicate: (this: This, value: T, index: number, obj: this) => boolean, + thisArg?: This ): T | undefined; /** @@ -26,9 +36,9 @@ interface Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: T, index: number, obj: T[]) => unknown, - thisArg?: any + findIndex( + predicate: (this: This, value: T, index: number, obj: this) => boolean, + thisArg?: This ): number; /** @@ -52,24 +62,45 @@ interface Array { */ copyWithin(target: number, start: number, end?: number): this; } +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined; +// find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number; interface ArrayConstructor { /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): T[]; + from(source: ArrayLike): T[]; /** - * Creates an array from an iterable object. - * @param arrayLike An array-like object to convert to an array. + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => U, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => U, + thisArg?: This ): U[]; /** @@ -78,6 +109,18 @@ interface ArrayConstructor { */ of(...items: T[]): T[]; } +// /** +// * Creates an array from an array-like object. +// * @param arrayLike An array-like object to convert to an array. +// */ +// from(arrayLike: ArrayLike): T[]; +// /** +// * Creates an array from an iterable object. +// * @param arrayLike An array-like object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; interface DateConstructor { new (value: number | string | Date): Date; @@ -301,7 +344,17 @@ interface ObjectConstructor { assign( target: T, ...sources: Ts - ): First>; + ): CheckNonNullable< + T, + First< + UnionToIntersection< + | [T] + | { + [K in keyof Ts]: [Ts[K]]; + }[number] + > + > + >; /** * Returns an array of all symbol properties found directly on object o. @@ -390,18 +443,23 @@ interface ReadonlyArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: ( - this: void, - value: T, - index: number, - obj: readonly T[] - ) => value is S, - thisArg?: any + find( + predicate: (this: This, value: T, index: number, obj: this) => value is S, + thisArg?: This ): S | undefined; - find( - predicate: (value: T, index: number, obj: readonly T[]) => unknown, - thisArg?: any + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find( + predicate: (this: This, value: T, index: number, obj: this) => boolean, + thisArg?: This ): T | undefined; /** @@ -413,11 +471,32 @@ interface ReadonlyArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: T, index: number, obj: readonly T[]) => unknown, - thisArg?: any + findIndex( + predicate: (this: This, value: T, index: number, obj: this) => boolean, + thisArg?: This ): number; } +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (this: void, value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined; +// find(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number; interface RegExp { /** diff --git a/generated/lib.es2015.iterable.d.ts b/generated/lib.es2015.iterable.d.ts index b5d62bd..ecfc2dd 100644 --- a/generated/lib.es2015.iterable.d.ts +++ b/generated/lib.es2015.iterable.d.ts @@ -64,26 +64,37 @@ interface Array { */ values(): IterableIterator; } - interface ArrayConstructor { /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. */ - from(iterable: Iterable | ArrayLike): T[]; + from(source: Iterable | ArrayLike): T[]; /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - iterable: Iterable | ArrayLike, - mapfn: (v: T, k: number) => U, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => U, + thisArg?: This ): U[]; } +// /** +// * Creates an array from an iterable object. +// * @param iterable An iterable object to convert to an array. +// */ +// from(iterable: Iterable | ArrayLike): T[]; +// /** +// * Creates an array from an iterable object. +// * @param iterable An iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(iterable: Iterable | ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; interface ReadonlyArray { /** Iterator of values in the array. */ @@ -263,22 +274,32 @@ interface Int8Array { */ values(): IterableIterator; } - interface Int8ArrayConstructor { new (elements: Iterable): Int8Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): Int8Array; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: Iterable, - mapfn?: (v: number, k: number) => number, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Int8Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; interface Uint8Array { [Symbol.iterator](): IterableIterator; @@ -295,22 +316,32 @@ interface Uint8Array { */ values(): IterableIterator; } - interface Uint8ArrayConstructor { new (elements: Iterable): Uint8Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): Uint8Array; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: Iterable, - mapfn?: (v: number, k: number) => number, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Uint8Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; interface Uint8ClampedArray { [Symbol.iterator](): IterableIterator; @@ -329,22 +360,32 @@ interface Uint8ClampedArray { */ values(): IterableIterator; } - interface Uint8ClampedArrayConstructor { new (elements: Iterable): Uint8ClampedArray; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): Uint8ClampedArray; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: Iterable, - mapfn?: (v: number, k: number) => number, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Uint8ClampedArray; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; interface Int16Array { [Symbol.iterator](): IterableIterator; @@ -363,22 +404,32 @@ interface Int16Array { */ values(): IterableIterator; } - interface Int16ArrayConstructor { new (elements: Iterable): Int16Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): Int16Array; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: Iterable, - mapfn?: (v: number, k: number) => number, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Int16Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; interface Uint16Array { [Symbol.iterator](): IterableIterator; @@ -395,22 +446,32 @@ interface Uint16Array { */ values(): IterableIterator; } - interface Uint16ArrayConstructor { new (elements: Iterable): Uint16Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): Uint16Array; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: Iterable, - mapfn?: (v: number, k: number) => number, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Uint16Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; interface Int32Array { [Symbol.iterator](): IterableIterator; @@ -427,22 +488,32 @@ interface Int32Array { */ values(): IterableIterator; } - interface Int32ArrayConstructor { new (elements: Iterable): Int32Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): Int32Array; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: Iterable, - mapfn?: (v: number, k: number) => number, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Int32Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; interface Uint32Array { [Symbol.iterator](): IterableIterator; @@ -459,22 +530,32 @@ interface Uint32Array { */ values(): IterableIterator; } - interface Uint32ArrayConstructor { new (elements: Iterable): Uint32Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): Uint32Array; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: Iterable, - mapfn?: (v: number, k: number) => number, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Uint32Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; interface Float32Array { [Symbol.iterator](): IterableIterator; @@ -491,22 +572,32 @@ interface Float32Array { */ values(): IterableIterator; } - interface Float32ArrayConstructor { new (elements: Iterable): Float32Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): Float32Array; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: Iterable, - mapfn?: (v: number, k: number) => number, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Float32Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; interface Float64Array { [Symbol.iterator](): IterableIterator; @@ -523,19 +614,29 @@ interface Float64Array { */ values(): IterableIterator; } - interface Float64ArrayConstructor { new (elements: Iterable): Float64Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): Float64Array; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: Iterable, - mapfn?: (v: number, k: number) => number, - thisArg?: any + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Float64Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; diff --git a/generated/lib.es2015.symbol.wellknown.d.ts b/generated/lib.es2015.symbol.wellknown.d.ts index 3ff9f67..e009c99 100644 --- a/generated/lib.es2015.symbol.wellknown.d.ts +++ b/generated/lib.es2015.symbol.wellknown.d.ts @@ -75,7 +75,9 @@ interface Array { * Returns an object whose properties have the value 'true' * when they will be absent when used in a 'with' statement. */ - readonly [Symbol.unscopables]: { [key: PropertyKey]: boolean }; + readonly [Symbol.unscopables]: { + [key: PropertyKey]: boolean; + }; } // /** // * Returns an object whose properties have the value 'true' diff --git a/generated/lib.es2017.object.d.ts b/generated/lib.es2017.object.d.ts index 1536cef..7ea448f 100644 --- a/generated/lib.es2017.object.d.ts +++ b/generated/lib.es2017.object.d.ts @@ -13,7 +13,7 @@ interface ObjectConstructor { * Returns an array of values of the enumerable properties of an object * @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. */ - values(o: unknown): unknown[]; + values(o: T): CheckNonNullable; /** * Returns an array of key/values of the enumerable properties of an object @@ -29,17 +29,20 @@ interface ObjectConstructor { * Returns an array of key/values of the enumerable properties of an object * @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. */ - entries(o: T): [string, unknown][]; + entries(o: T): CheckNonNullable; /** * Returns an object containing all own property descriptors of an object * @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. */ - getOwnPropertyDescriptors( - o: T - ): { [P in keyof T]: TypedPropertyDescriptor } & { - [x: string]: PropertyDescriptor; - }; + getOwnPropertyDescriptors(o: T): CheckNonNullable< + T, + { + [P in keyof T]: TypedPropertyDescriptor; + } & { + [x: string]: PropertyDescriptor; + } + >; } // /** // * Returns an array of values of the enumerable properties of an object @@ -61,3 +64,8 @@ interface ObjectConstructor { // * @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. // */ // entries(o: {}): [string, any][]; +// /** +// * Returns an object containing all own property descriptors of an object +// * @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. +// */ +// getOwnPropertyDescriptors(o: T): {[P in keyof T]: TypedPropertyDescriptor} & { [x: string]: PropertyDescriptor }; diff --git a/generated/lib.es2020.bigint.d.ts b/generated/lib.es2020.bigint.d.ts index e2a3155..ac6871d 100644 --- a/generated/lib.es2020.bigint.d.ts +++ b/generated/lib.es2020.bigint.d.ts @@ -229,11 +229,6 @@ interface BigIntConstructor { } declare var BigInt: BigIntConstructor; - -/** - * A typed array of 64-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated, an exception is raised. - */ interface BigInt64Array { /** The size in bytes of each element in the array. */ readonly BYTES_PER_ELEMENT: number; @@ -260,7 +255,6 @@ interface BigInt64Array { /** Yields index, value pairs for every entry in the array. */ entries(): IterableIterator<[number, bigint]>; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -269,9 +263,14 @@ interface BigInt64Array { * @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. */ - every( - predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, - thisArg?: any + every( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -283,7 +282,6 @@ interface BigInt64Array { * length+end. */ fill(value: bigint, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -291,11 +289,15 @@ interface BigInt64Array { * @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. */ - filter( - predicate: (value: bigint, index: number, array: BigInt64Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): BigInt64Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -305,11 +307,15 @@ interface BigInt64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, - thisArg?: any + find( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): bigint | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -319,11 +325,15 @@ interface BigInt64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, - thisArg?: any + findIndex( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -331,9 +341,9 @@ interface BigInt64Array { * @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. */ - forEach( - callbackfn: (value: bigint, index: number, array: BigInt64Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: bigint, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -371,7 +381,6 @@ interface BigInt64Array { /** The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -380,30 +389,30 @@ interface BigInt64Array { * @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. */ - map( - callbackfn: (value: bigint, index: number, array: BigInt64Array) => bigint, - thisArg?: any + map( + callbackfn: ( + this: This, + value: bigint, + index: number, + array: this + ) => bigint, + thisArg?: This ): BigInt64Array; - /** * 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. * @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. - * @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. */ - reduce( + reduce( callbackfn: ( - previousValue: bigint, + previousValue: bigint | U, currentValue: bigint, currentIndex: number, - array: BigInt64Array - ) => bigint - ): bigint; - + array: this + ) => U + ): bigint | U; /** * 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 @@ -414,35 +423,30 @@ interface BigInt64Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: bigint, currentIndex: number, - array: BigInt64Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( + reduceRight( callbackfn: ( - previousValue: bigint, + previousValue: bigint | U, currentValue: bigint, currentIndex: number, - array: BigInt64Array - ) => bigint - ): bigint; - + array: this + ) => U + ): bigint | U; /** * 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 @@ -453,12 +457,12 @@ interface BigInt64Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: bigint, currentIndex: number, - array: BigInt64Array + array: this ) => U, initialValue: U ): U; @@ -479,7 +483,6 @@ interface BigInt64Array { * @param end The end of the specified portion of the array. */ slice(start?: number, end?: number): BigInt64Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls the @@ -488,9 +491,14 @@ interface BigInt64Array { * @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. */ - some( - predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, - thisArg?: any + some( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -525,6 +533,113 @@ interface BigInt64Array { [index: number]: bigint; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns false, +// * or until the end of the array. +// * @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. +// */ +// every(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: bigint, index: number, array: BigInt64Array) => any, thisArg?: any): BigInt64Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): bigint | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: bigint, index: number, array: BigInt64Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: bigint, index: number, array: BigInt64Array) => bigint, thisArg?: any): BigInt64Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls the +// * predicate function for each element in the array until the predicate returns true, or until +// * the end of the array. +// * @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. +// */ +// some(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean; interface BigInt64ArrayConstructor { readonly prototype: BigInt64Array; @@ -544,27 +659,33 @@ interface BigInt64ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: bigint[]): BigInt64Array; - + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: Iterable | ArrayLike): BigInt64Array; /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike): BigInt64Array; - from( - arrayLike: ArrayLike, - mapfn: (v: U, k: number) => bigint, - thisArg?: any + from( + arrayLike: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => bigint, + thisArg?: This ): BigInt64Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike): BigInt64Array; +// from(arrayLike: ArrayLike, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigInt64Array; declare var BigInt64Array: BigInt64ArrayConstructor; - -/** - * A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated, an exception is raised. - */ interface BigUint64Array { /** The size in bytes of each element in the array. */ readonly BYTES_PER_ELEMENT: number; @@ -591,7 +712,6 @@ interface BigUint64Array { /** Yields index, value pairs for every entry in the array. */ entries(): IterableIterator<[number, bigint]>; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -600,9 +720,14 @@ interface BigUint64Array { * @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. */ - every( - predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, - thisArg?: any + every( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -614,7 +739,6 @@ interface BigUint64Array { * length+end. */ fill(value: bigint, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -622,11 +746,15 @@ interface BigUint64Array { * @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. */ - filter( - predicate: (value: bigint, index: number, array: BigUint64Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): BigUint64Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -636,11 +764,15 @@ interface BigUint64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, - thisArg?: any + find( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): bigint | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -650,11 +782,15 @@ interface BigUint64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, - thisArg?: any + findIndex( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -662,9 +798,9 @@ interface BigUint64Array { * @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. */ - forEach( - callbackfn: (value: bigint, index: number, array: BigUint64Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: bigint, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -702,7 +838,6 @@ interface BigUint64Array { /** The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -711,30 +846,30 @@ interface BigUint64Array { * @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. */ - map( - callbackfn: (value: bigint, index: number, array: BigUint64Array) => bigint, - thisArg?: any + map( + callbackfn: ( + this: This, + value: bigint, + index: number, + array: this + ) => bigint, + thisArg?: This ): BigUint64Array; - /** * 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. * @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. - * @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. */ - reduce( + reduce( callbackfn: ( - previousValue: bigint, + previousValue: bigint | U, currentValue: bigint, currentIndex: number, - array: BigUint64Array - ) => bigint - ): bigint; - + array: this + ) => U + ): bigint | U; /** * 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 @@ -745,35 +880,30 @@ interface BigUint64Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: bigint, currentIndex: number, - array: BigUint64Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( + reduceRight( callbackfn: ( - previousValue: bigint, + previousValue: bigint | U, currentValue: bigint, currentIndex: number, - array: BigUint64Array - ) => bigint - ): bigint; - + array: this + ) => U + ): bigint | U; /** * 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 @@ -784,12 +914,12 @@ interface BigUint64Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: bigint, currentIndex: number, - array: BigUint64Array + array: this ) => U, initialValue: U ): U; @@ -810,7 +940,6 @@ interface BigUint64Array { * @param end The end of the specified portion of the array. */ slice(start?: number, end?: number): BigUint64Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls the @@ -819,9 +948,14 @@ interface BigUint64Array { * @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. */ - some( - predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, - thisArg?: any + some( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -856,6 +990,113 @@ interface BigUint64Array { [index: number]: bigint; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns false, +// * or until the end of the array. +// * @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. +// */ +// every(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: bigint, index: number, array: BigUint64Array) => any, thisArg?: any): BigUint64Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): bigint | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: bigint, index: number, array: BigUint64Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: bigint, index: number, array: BigUint64Array) => bigint, thisArg?: any): BigUint64Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls the +// * predicate function for each element in the array until the predicate returns true, or until +// * the end of the array. +// * @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. +// */ +// some(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean; interface BigUint64ArrayConstructor { readonly prototype: BigUint64Array; @@ -875,20 +1116,31 @@ interface BigUint64ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: bigint[]): BigUint64Array; - + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: Iterable | ArrayLike): BigUint64Array; /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike): BigUint64Array; - from( - arrayLike: ArrayLike, - mapfn: (v: U, k: number) => bigint, - thisArg?: any + from( + arrayLike: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => bigint, + thisArg?: This ): BigUint64Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike): BigUint64Array; +// from(arrayLike: ArrayLike, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigUint64Array; declare var BigUint64Array: BigUint64ArrayConstructor; diff --git a/generated/lib.es2022.object.d.ts b/generated/lib.es2022.object.d.ts index 1198123..28b6c85 100644 --- a/generated/lib.es2022.object.d.ts +++ b/generated/lib.es2022.object.d.ts @@ -14,7 +14,9 @@ interface ObjectConstructor { : symbol extends Key ? {} : Key extends PropertyKey - ? { [key in Key]: unknown } + ? { + [key in Key]: unknown; + } : {}; } // /** diff --git a/generated/lib.es5.d.ts b/generated/lib.es5.d.ts index fdc0756..51bf39f 100644 --- a/generated/lib.es5.d.ts +++ b/generated/lib.es5.d.ts @@ -130,7 +130,9 @@ interface Object { : symbol extends Key ? {} : Key extends PropertyKey - ? { [key in Key]: unknown } + ? { + [key in Key]: unknown; + } : {}; /** @@ -163,7 +165,7 @@ interface ObjectConstructor { * Returns the prototype of an object. * @param o The object that references the prototype. */ - getPrototypeOf(o: any): unknown; + getPrototypeOf(o: T): CheckNonNullable; /** * Gets the own property descriptor of the specified object. @@ -171,17 +173,17 @@ interface ObjectConstructor { * @param o Object that contains the property. * @param p Name of the property. */ - getOwnPropertyDescriptor( - o: any, + getOwnPropertyDescriptor( + o: T, p: PropertyKey - ): PropertyDescriptor | undefined; + ): CheckNonNullable; /** * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ - getOwnPropertyNames(o: O): O extends undefined | null ? never : string[]; + getOwnPropertyNames(o: T): CheckNonNullable; /** * Creates an object that has the specified prototype or that has null prototype. @@ -204,9 +206,13 @@ interface ObjectConstructor { o: O, properties: P & ThisType ): { - [K in keyof (O & P)]: P[K] extends { value: infer V } + [K in keyof (O & P)]: P[K] extends { + value: infer V; + } ? V - : P[K] extends { get: () => infer V } + : P[K] extends { + get: () => infer V; + } ? V : K extends keyof O ? O[K] @@ -222,9 +228,13 @@ interface ObjectConstructor { o: null, properties: P & ThisType ): { - [K in keyof P]: P[K] extends { value: infer V } + [K in keyof P]: P[K] extends { + value: infer V; + } ? V - : P[K] extends { get: () => infer V } + : P[K] extends { + get: () => infer V; + } ? V : unknown; }; @@ -246,9 +256,13 @@ interface ObjectConstructor { ): O & (P extends PropertyKey // required to make P distributive ? { - [K in P]: D extends { value: infer V } + [K in P]: D extends { + value: infer V; + } ? V - : D extends { get: () => infer V } + : D extends { + get: () => infer V; + } ? V : unknown; } @@ -266,9 +280,13 @@ interface ObjectConstructor { o: O, properties: P & ThisType ): { - [K in keyof (O & P)]: P[K] extends { value: infer V } + [K in keyof (O & P)]: P[K] extends { + value: infer V; + } ? V - : P[K] extends { get: () => infer V } + : P[K] extends { + get: () => infer V; + } ? V : K extends keyof O ? O[K] @@ -338,6 +356,13 @@ interface ObjectConstructor { // */ // getPrototypeOf(o: any): any; // /** +// * Gets the own property descriptor of the specified object. +// * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. +// * @param o Object that contains the property. +// * @param p Name of the property. +// */ +// getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; +// /** // * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly // * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. // * @param o Object that contains the own properties. @@ -486,17 +511,12 @@ interface CallableFunction extends Function { // bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; interface NewableFunction extends Function { - /** - * Calls the function with the specified object as the this value and the elements of specified array as the arguments. - * @param thisArg The object to be used as the this object. - */ - apply(this: new () => T, thisArg: T): void; - /** * Calls the function with the specified object as the this value and the elements of specified array as the arguments. * @param thisArg The object to be used as the this object. * @param args An array of argument values to be passed to the function. */ + apply(this: new () => T, thisArg: T): void; apply( this: new (...args: A) => T, thisArg: T, @@ -513,7 +533,6 @@ interface NewableFunction extends Function { thisArg: T, ...args: A ): void; - /** * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. @@ -527,19 +546,6 @@ interface NewableFunction extends Function { ): new (...args: B) => R; } // /** -// * Calls the function with the specified object as the this value and the elements of specified array as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args An array of argument values to be passed to the function. -// */ -// apply(this: new () => T, thisArg: T): void; -// apply(this: new (...args: A) => T, thisArg: T, args: A): void; -// /** -// * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args Argument values to be passed to the function. -// */ -// call(this: new (...args: A) => T, thisArg: T, ...args: A): void; -// /** // * For a given function, creates a bound function that has the same body as the original function. // * The this object of the bound function is associated with the specified object, and has the specified initial parameters. // * @param thisArg The object to be used as the this object. @@ -1448,14 +1454,11 @@ interface ReadonlyArray { * If thisArg is omitted, undefined is used as the this value. */ every( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => value is S, + predicate: (this: This, value: T, index: number, array: this) => value is S, thisArg?: This - ): this is readonly S[]; + ): this is { + [K in keyof this]: S; + }; /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -1465,12 +1468,7 @@ interface ReadonlyArray { * If thisArg is omitted, undefined is used as the this value. */ every( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): boolean; /** @@ -1482,12 +1480,7 @@ interface ReadonlyArray { * If thisArg is omitted, undefined is used as the this value. */ some( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): boolean; /** @@ -1496,12 +1489,7 @@ interface ReadonlyArray { * @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. */ forEach( - callbackfn: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => void, + callbackfn: (this: This, value: T, index: number, array: this) => void, thisArg?: This ): void; /** @@ -1510,21 +1498,18 @@ interface ReadonlyArray { * @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. */ map( - callbackfn: (this: This, value: T, index: number, array: readonly T[]) => U, + callbackfn: (this: This, value: T, index: number, array: this) => U, thisArg?: This - ): U[]; + ): { + -readonly [K in keyof this]: U; + }; /** * Returns the elements of an array that meet the condition specified in a callback function. * @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. * @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. */ filter( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => value is S, + predicate: (this: This, value: T, index: number, array: this) => value is S, thisArg?: This ): S[]; /** @@ -1533,83 +1518,58 @@ interface ReadonlyArray { * @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. */ filter( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): T[]; /** * 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. * @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. - * @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. */ - reduce( - callbackfn: ( - previousValue: T, - currentValue: T, - currentIndex: number, - array: readonly T[] - ) => T - ): T; - reduce( + reduce( callbackfn: ( - previousValue: T, + previousValue: T | U, currentValue: T, currentIndex: number, - array: readonly T[] - ) => T, - initialValue: T - ): T; + array: this + ) => U + ): T | U; /** * 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. * @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. * @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. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: T, currentIndex: number, - array: readonly T[] + array: this ) => U, initialValue: U ): U; /** * 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. * @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. - * @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. */ - reduceRight( - callbackfn: ( - previousValue: T, - currentValue: T, - currentIndex: number, - array: readonly T[] - ) => T - ): T; - reduceRight( + reduceRight( callbackfn: ( - previousValue: T, + previousValue: T | U, currentValue: T, currentIndex: number, - array: readonly T[] - ) => T, - initialValue: T - ): T; + array: this + ) => U + ): T | U; /** * 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. * @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. * @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. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: T, currentIndex: number, - array: readonly T[] + array: this ) => U, initialValue: U ): U; @@ -1667,6 +1627,32 @@ interface ReadonlyArray { // * @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. // */ // filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[]; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; +// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; +// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; interface ConcatArray { readonly length: number; @@ -1751,7 +1737,7 @@ interface Array { * @param deleteCount The number of elements to remove. * @returns An array containing the elements that were deleted. */ - splice(start: number, deleteCount?: number): this; + splice(start: number, deleteCount?: number): T[]; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. @@ -1759,7 +1745,7 @@ interface Array { * @param items Elements to insert into the array in place of the deleted elements. * @returns An array containing the elements that were deleted. */ - splice(start: number, deleteCount: number, ...items: T[]): this; + splice(start: number, deleteCount: number, ...items: T[]): T[]; /** * Inserts new elements at the start of an array, and returns the new length of the array. * @param items Elements to insert at the start of the array. @@ -1786,9 +1772,11 @@ interface Array { * If thisArg is omitted, undefined is used as the this value. */ every( - predicate: (this: This, value: T, index: number, array: T[]) => value is S, + predicate: (this: This, value: T, index: number, array: this) => value is S, thisArg?: This - ): this is S[]; + ): this is { + [K in keyof this]: S; + }; /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -1798,7 +1786,7 @@ interface Array { * If thisArg is omitted, undefined is used as the this value. */ every( - predicate: (this: This, value: T, index: number, array: T[]) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): boolean; /** @@ -1810,7 +1798,7 @@ interface Array { * If thisArg is omitted, undefined is used as the this value. */ some( - predicate: (this: This, value: T, index: number, array: T[]) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): boolean; /** @@ -1819,7 +1807,7 @@ interface Array { * @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. */ forEach( - callbackfn: (this: This, value: T, index: number, array: T[]) => void, + callbackfn: (this: This, value: T, index: number, array: this) => void, thisArg?: This ): void; /** @@ -1828,16 +1816,18 @@ interface Array { * @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. */ map( - callbackfn: (this: This, value: T, index: number, array: T[]) => U, + callbackfn: (this: This, value: T, index: number, array: this) => U, thisArg?: This - ): U[]; + ): { + [K in keyof this]: U; + }; /** * Returns the elements of an array that meet the condition specified in a callback function. * @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. * @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. */ filter( - predicate: (this: This, value: T, index: number, array: T[]) => value is S, + predicate: (this: This, value: T, index: number, array: this) => value is S, thisArg?: This ): S[]; /** @@ -1846,78 +1836,58 @@ interface Array { * @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. */ filter( - predicate: (this: This, value: T, index: number, array: T[]) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): T[]; /** * 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. * @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. - * @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. */ - reduce( - callbackfn: ( - previousValue: T, - currentValue: T, - currentIndex: number, - array: T[] - ) => T - ): T; - reduce( + reduce( callbackfn: ( - previousValue: T, + previousValue: T | U, currentValue: T, currentIndex: number, - array: T[] - ) => T, - initialValue: T - ): T; + array: this + ) => U + ): T | U; /** * 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. * @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. * @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. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: T, currentIndex: number, - array: T[] + array: this ) => U, initialValue: U ): U; /** * 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. * @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. - * @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. */ - reduceRight( - callbackfn: ( - previousValue: T, - currentValue: T, - currentIndex: number, - array: T[] - ) => T - ): T; - reduceRight( + reduceRight( callbackfn: ( - previousValue: T, + previousValue: T | U, currentValue: T, currentIndex: number, - array: T[] - ) => T, - initialValue: T - ): T; + array: this + ) => U + ): T | U; /** * 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. * @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. * @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. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: T, currentIndex: number, - array: T[] + array: this ) => U, initialValue: U ): U; @@ -1925,21 +1895,6 @@ interface Array { [n: number]: T; } // /** -// * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. -// * @param start The zero-based location in the array from which to start removing elements. -// * @param deleteCount The number of elements to remove. -// * @returns An array containing the elements that were deleted. -// */ -// splice(start: number, deleteCount?: number): T[]; -// /** -// * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. -// * @param start The zero-based location in the array from which to start removing elements. -// * @param deleteCount The number of elements to remove. -// * @param items Elements to insert into the array in place of the deleted elements. -// * @returns An array containing the elements that were deleted. -// */ -// splice(start: number, deleteCount: number, ...items: T[]): T[]; -// /** // * Determines whether all the members of an array satisfy the specified test. // * @param predicate A function that accepts up to three arguments. The every method calls // * the predicate function for each element in the array until the predicate returns a value @@ -1990,6 +1945,32 @@ interface Array { // * @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. // */ // filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; +// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; +// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; interface ArrayConstructor { new (arrayLength: number): T[]; @@ -2417,11 +2398,6 @@ interface DataViewConstructor { ): DataView; } declare var DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ interface Int8Array { /** * The size in bytes of each element in the array. @@ -2453,7 +2429,6 @@ interface Int8Array { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -2462,9 +2437,14 @@ interface Int8Array { * @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. */ - every( - predicate: (value: number, index: number, array: Int8Array) => unknown, - thisArg?: any + every( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -2476,7 +2456,6 @@ interface Int8Array { * length+end. */ fill(value: number, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -2484,11 +2463,15 @@ interface Int8Array { * @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. */ - filter( - predicate: (value: number, index: number, array: Int8Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): Int8Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -2498,11 +2481,10 @@ interface Int8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: number, index: number, obj: Int8Array) => boolean, - thisArg?: any + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -2512,11 +2494,10 @@ interface Int8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: number, index: number, obj: Int8Array) => boolean, - thisArg?: any + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -2524,9 +2505,9 @@ interface Int8Array { * @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. */ - forEach( - callbackfn: (value: number, index: number, array: Int8Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -2556,7 +2537,6 @@ interface Int8Array { * The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -2565,39 +2545,30 @@ interface Int8Array { * @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. */ - map( - callbackfn: (value: number, index: number, array: Int8Array) => number, - thisArg?: any + map( + callbackfn: ( + this: This, + value: number, + index: number, + array: this + ) => number, + thisArg?: This ): Int8Array; - /** * 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. * @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. - * @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. */ - reduce( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Int8Array - ) => number - ): number; - reduce( + reduce( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Int8Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -2608,44 +2579,30 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Int8Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Int8Array - ) => number - ): number; - reduceRight( + reduceRight( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Int8Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -2656,12 +2613,12 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Int8Array + array: this ) => U, initialValue: U ): U; @@ -2684,7 +2641,6 @@ interface Int8Array { * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ slice(start?: number, end?: number): Int8Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls @@ -2693,9 +2649,14 @@ interface Int8Array { * @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. */ - some( - predicate: (value: number, index: number, array: Int8Array) => unknown, - thisArg?: any + some( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -2732,6 +2693,116 @@ interface Int8Array { [index: number]: number; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @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. +// */ +// every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @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. +// */ +// some(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; + interface Int8ArrayConstructor { readonly prototype: Int8Array; new (length: number): Int8Array; @@ -2752,31 +2823,37 @@ interface Int8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): Int8Array; - + from(source: ArrayLike): Int8Array; /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => number, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Int8Array; } -declare var Int8Array: Int8ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Int8Array; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ +declare var Int8Array: Int8ArrayConstructor; interface Uint8Array { /** * The size in bytes of each element in the array. @@ -2808,7 +2885,6 @@ interface Uint8Array { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -2817,9 +2893,14 @@ interface Uint8Array { * @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. */ - every( - predicate: (value: number, index: number, array: Uint8Array) => unknown, - thisArg?: any + every( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -2831,7 +2912,6 @@ interface Uint8Array { * length+end. */ fill(value: number, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -2839,11 +2919,15 @@ interface Uint8Array { * @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. */ - filter( - predicate: (value: number, index: number, array: Uint8Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): Uint8Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -2853,11 +2937,10 @@ interface Uint8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: number, index: number, obj: Uint8Array) => boolean, - thisArg?: any + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -2867,11 +2950,10 @@ interface Uint8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: number, index: number, obj: Uint8Array) => boolean, - thisArg?: any + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -2879,9 +2961,9 @@ interface Uint8Array { * @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. */ - forEach( - callbackfn: (value: number, index: number, array: Uint8Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -2911,7 +2993,6 @@ interface Uint8Array { * The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -2920,39 +3001,30 @@ interface Uint8Array { * @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. */ - map( - callbackfn: (value: number, index: number, array: Uint8Array) => number, - thisArg?: any + map( + callbackfn: ( + this: This, + value: number, + index: number, + array: this + ) => number, + thisArg?: This ): Uint8Array; - /** * 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. * @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. - * @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. */ - reduce( + reduce( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Uint8Array - ) => number - ): number; - reduce( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Uint8Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -2963,44 +3035,30 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Uint8Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Uint8Array - ) => number - ): number; - reduceRight( + reduceRight( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Uint8Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -3011,12 +3069,12 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Uint8Array + array: this ) => U, initialValue: U ): U; @@ -3039,7 +3097,6 @@ interface Uint8Array { * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ slice(start?: number, end?: number): Uint8Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls @@ -3048,9 +3105,14 @@ interface Uint8Array { * @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. */ - some( - predicate: (value: number, index: number, array: Uint8Array) => unknown, - thisArg?: any + some( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -3087,6 +3149,115 @@ interface Uint8Array { [index: number]: number; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @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. +// */ +// every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @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. +// */ +// some(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; interface Uint8ArrayConstructor { readonly prototype: Uint8Array; @@ -3108,31 +3279,37 @@ interface Uint8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): Uint8Array; - + from(source: ArrayLike): Uint8Array; /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => number, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Uint8Array; } -declare var Uint8Array: Uint8ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint8Array; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ +declare var Uint8Array: Uint8ArrayConstructor; interface Uint8ClampedArray { /** * The size in bytes of each element in the array. @@ -3164,7 +3341,6 @@ interface Uint8ClampedArray { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -3173,13 +3349,14 @@ interface Uint8ClampedArray { * @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. */ - every( + every( predicate: ( + this: This, value: number, index: number, - array: Uint8ClampedArray - ) => unknown, - thisArg?: any + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -3191,7 +3368,6 @@ interface Uint8ClampedArray { * length+end. */ fill(value: number, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -3199,11 +3375,15 @@ interface Uint8ClampedArray { * @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. */ - filter( - predicate: (value: number, index: number, array: Uint8ClampedArray) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): Uint8ClampedArray; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -3213,15 +3393,10 @@ interface Uint8ClampedArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: ( - value: number, - index: number, - obj: Uint8ClampedArray - ) => boolean, - thisArg?: any + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -3231,15 +3406,10 @@ interface Uint8ClampedArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: ( - value: number, - index: number, - obj: Uint8ClampedArray - ) => boolean, - thisArg?: any + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -3247,13 +3417,9 @@ interface Uint8ClampedArray { * @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. */ - forEach( - callbackfn: ( - value: number, - index: number, - array: Uint8ClampedArray - ) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -3283,7 +3449,6 @@ interface Uint8ClampedArray { * The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -3292,43 +3457,30 @@ interface Uint8ClampedArray { * @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. */ - map( + map( callbackfn: ( + this: This, value: number, index: number, - array: Uint8ClampedArray + array: this ) => number, - thisArg?: any + thisArg?: This ): Uint8ClampedArray; - /** * 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. * @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. - * @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. */ - reduce( + reduce( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Uint8ClampedArray - ) => number - ): number; - reduce( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Uint8ClampedArray - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -3339,44 +3491,30 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Uint8ClampedArray + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Uint8ClampedArray - ) => number - ): number; - reduceRight( + reduceRight( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Uint8ClampedArray - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -3387,12 +3525,12 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Uint8ClampedArray + array: this ) => U, initialValue: U ): U; @@ -3415,7 +3553,6 @@ interface Uint8ClampedArray { * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ slice(start?: number, end?: number): Uint8ClampedArray; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls @@ -3424,13 +3561,14 @@ interface Uint8ClampedArray { * @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. */ - some( + some( predicate: ( + this: This, value: number, index: number, - array: Uint8ClampedArray - ) => unknown, - thisArg?: any + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -3467,6 +3605,115 @@ interface Uint8ClampedArray { [index: number]: number; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @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. +// */ +// every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @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. +// */ +// some(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; interface Uint8ClampedArrayConstructor { readonly prototype: Uint8ClampedArray; @@ -3488,31 +3735,37 @@ interface Uint8ClampedArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8ClampedArray; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): Uint8ClampedArray; - + from(source: ArrayLike): Uint8ClampedArray; /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => number, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Uint8ClampedArray; } -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint8ClampedArray; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; interface Int16Array { /** * The size in bytes of each element in the array. @@ -3544,7 +3797,6 @@ interface Int16Array { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -3553,9 +3805,14 @@ interface Int16Array { * @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. */ - every( - predicate: (value: number, index: number, array: Int16Array) => unknown, - thisArg?: any + every( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -3567,7 +3824,6 @@ interface Int16Array { * length+end. */ fill(value: number, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -3575,11 +3831,15 @@ interface Int16Array { * @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. */ - filter( - predicate: (value: number, index: number, array: Int16Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): Int16Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -3589,11 +3849,10 @@ interface Int16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: number, index: number, obj: Int16Array) => boolean, - thisArg?: any + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -3603,11 +3862,10 @@ interface Int16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: number, index: number, obj: Int16Array) => boolean, - thisArg?: any + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -3615,9 +3873,9 @@ interface Int16Array { * @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. */ - forEach( - callbackfn: (value: number, index: number, array: Int16Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This ): void; /** * Returns the index of the first occurrence of a value in an array. @@ -3646,7 +3904,6 @@ interface Int16Array { * The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -3655,39 +3912,30 @@ interface Int16Array { * @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. */ - map( - callbackfn: (value: number, index: number, array: Int16Array) => number, - thisArg?: any + map( + callbackfn: ( + this: This, + value: number, + index: number, + array: this + ) => number, + thisArg?: This ): Int16Array; - /** * 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. * @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. - * @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. */ - reduce( + reduce( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Int16Array - ) => number - ): number; - reduce( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Int16Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -3698,44 +3946,30 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Int16Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( + reduceRight( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Int16Array - ) => number - ): number; - reduceRight( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Int16Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -3746,12 +3980,12 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Int16Array + array: this ) => U, initialValue: U ): U; @@ -3774,7 +4008,6 @@ interface Int16Array { * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ slice(start?: number, end?: number): Int16Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls @@ -3783,9 +4016,14 @@ interface Int16Array { * @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. */ - some( - predicate: (value: number, index: number, array: Int16Array) => unknown, - thisArg?: any + some( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -3822,6 +4060,115 @@ interface Int16Array { [index: number]: number; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @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. +// */ +// every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @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. +// */ +// some(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; interface Int16ArrayConstructor { readonly prototype: Int16Array; @@ -3843,31 +4190,37 @@ interface Int16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): Int16Array; - + from(source: ArrayLike): Int16Array; /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => number, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Int16Array; } -declare var Int16Array: Int16ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Int16Array; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ +declare var Int16Array: Int16ArrayConstructor; interface Uint16Array { /** * The size in bytes of each element in the array. @@ -3899,7 +4252,6 @@ interface Uint16Array { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -3908,9 +4260,14 @@ interface Uint16Array { * @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. */ - every( - predicate: (value: number, index: number, array: Uint16Array) => unknown, - thisArg?: any + every( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -3922,7 +4279,6 @@ interface Uint16Array { * length+end. */ fill(value: number, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -3930,11 +4286,15 @@ interface Uint16Array { * @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. */ - filter( - predicate: (value: number, index: number, array: Uint16Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): Uint16Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -3944,11 +4304,10 @@ interface Uint16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: number, index: number, obj: Uint16Array) => boolean, - thisArg?: any + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -3958,11 +4317,10 @@ interface Uint16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: number, index: number, obj: Uint16Array) => boolean, - thisArg?: any + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -3970,9 +4328,9 @@ interface Uint16Array { * @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. */ - forEach( - callbackfn: (value: number, index: number, array: Uint16Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -4002,7 +4360,6 @@ interface Uint16Array { * The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -4011,39 +4368,30 @@ interface Uint16Array { * @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. */ - map( - callbackfn: (value: number, index: number, array: Uint16Array) => number, - thisArg?: any + map( + callbackfn: ( + this: This, + value: number, + index: number, + array: this + ) => number, + thisArg?: This ): Uint16Array; - /** * 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. * @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. - * @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. */ - reduce( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Uint16Array - ) => number - ): number; - reduce( + reduce( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Uint16Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -4054,44 +4402,30 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Uint16Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Uint16Array - ) => number - ): number; - reduceRight( + reduceRight( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Uint16Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -4102,12 +4436,12 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Uint16Array + array: this ) => U, initialValue: U ): U; @@ -4130,7 +4464,6 @@ interface Uint16Array { * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ slice(start?: number, end?: number): Uint16Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls @@ -4139,9 +4472,14 @@ interface Uint16Array { * @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. */ - some( - predicate: (value: number, index: number, array: Uint16Array) => unknown, - thisArg?: any + some( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -4178,6 +4516,115 @@ interface Uint16Array { [index: number]: number; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @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. +// */ +// every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @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. +// */ +// some(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; interface Uint16ArrayConstructor { readonly prototype: Uint16Array; @@ -4199,30 +4646,37 @@ interface Uint16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): Uint16Array; - + from(source: ArrayLike): Uint16Array; /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => number, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Uint16Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint16Array; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; + declare var Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ interface Int32Array { /** * The size in bytes of each element in the array. @@ -4254,7 +4708,6 @@ interface Int32Array { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -4263,9 +4716,14 @@ interface Int32Array { * @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. */ - every( - predicate: (value: number, index: number, array: Int32Array) => unknown, - thisArg?: any + every( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -4277,7 +4735,6 @@ interface Int32Array { * length+end. */ fill(value: number, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -4285,11 +4742,15 @@ interface Int32Array { * @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. */ - filter( - predicate: (value: number, index: number, array: Int32Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): Int32Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -4299,11 +4760,10 @@ interface Int32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: number, index: number, obj: Int32Array) => boolean, - thisArg?: any + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -4313,11 +4773,10 @@ interface Int32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: number, index: number, obj: Int32Array) => boolean, - thisArg?: any + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -4325,9 +4784,9 @@ interface Int32Array { * @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. */ - forEach( - callbackfn: (value: number, index: number, array: Int32Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -4357,7 +4816,6 @@ interface Int32Array { * The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -4366,39 +4824,30 @@ interface Int32Array { * @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. */ - map( - callbackfn: (value: number, index: number, array: Int32Array) => number, - thisArg?: any + map( + callbackfn: ( + this: This, + value: number, + index: number, + array: this + ) => number, + thisArg?: This ): Int32Array; - /** * 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. * @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. - * @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. */ - reduce( + reduce( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Int32Array - ) => number - ): number; - reduce( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Int32Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -4409,44 +4858,30 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Int32Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Int32Array - ) => number - ): number; - reduceRight( + reduceRight( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Int32Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -4457,12 +4892,12 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Int32Array + array: this ) => U, initialValue: U ): U; @@ -4485,7 +4920,6 @@ interface Int32Array { * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ slice(start?: number, end?: number): Int32Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls @@ -4494,9 +4928,14 @@ interface Int32Array { * @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. */ - some( - predicate: (value: number, index: number, array: Int32Array) => unknown, - thisArg?: any + some( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -4533,6 +4972,115 @@ interface Int32Array { [index: number]: number; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @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. +// */ +// every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @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. +// */ +// some(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; interface Int32ArrayConstructor { readonly prototype: Int32Array; @@ -4554,31 +5102,37 @@ interface Int32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): Int32Array; - + from(source: ArrayLike): Int32Array; /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => number, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Int32Array; } -declare var Int32Array: Int32ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Int32Array; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ +declare var Int32Array: Int32ArrayConstructor; interface Uint32Array { /** * The size in bytes of each element in the array. @@ -4610,7 +5164,6 @@ interface Uint32Array { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -4619,9 +5172,14 @@ interface Uint32Array { * @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. */ - every( - predicate: (value: number, index: number, array: Uint32Array) => unknown, - thisArg?: any + every( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -4633,7 +5191,6 @@ interface Uint32Array { * length+end. */ fill(value: number, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -4641,11 +5198,15 @@ interface Uint32Array { * @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. */ - filter( - predicate: (value: number, index: number, array: Uint32Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): Uint32Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -4655,11 +5216,10 @@ interface Uint32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: number, index: number, obj: Uint32Array) => boolean, - thisArg?: any + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -4669,11 +5229,10 @@ interface Uint32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: number, index: number, obj: Uint32Array) => boolean, - thisArg?: any + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -4681,9 +5240,9 @@ interface Uint32Array { * @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. */ - forEach( - callbackfn: (value: number, index: number, array: Uint32Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This ): void; /** * Returns the index of the first occurrence of a value in an array. @@ -4712,7 +5271,6 @@ interface Uint32Array { * The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -4721,39 +5279,30 @@ interface Uint32Array { * @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. */ - map( - callbackfn: (value: number, index: number, array: Uint32Array) => number, - thisArg?: any + map( + callbackfn: ( + this: This, + value: number, + index: number, + array: this + ) => number, + thisArg?: This ): Uint32Array; - /** * 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. * @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. - * @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. */ - reduce( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Uint32Array - ) => number - ): number; - reduce( + reduce( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Uint32Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -4764,44 +5313,30 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Uint32Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Uint32Array - ) => number - ): number; - reduceRight( + reduceRight( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Uint32Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -4812,12 +5347,12 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Uint32Array + array: this ) => U, initialValue: U ): U; @@ -4840,7 +5375,6 @@ interface Uint32Array { * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ slice(start?: number, end?: number): Uint32Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls @@ -4849,9 +5383,14 @@ interface Uint32Array { * @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. */ - some( - predicate: (value: number, index: number, array: Uint32Array) => unknown, - thisArg?: any + some( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -4888,6 +5427,115 @@ interface Uint32Array { [index: number]: number; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @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. +// */ +// every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @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. +// */ +// some(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; interface Uint32ArrayConstructor { readonly prototype: Uint32Array; @@ -4909,31 +5557,37 @@ interface Uint32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): Uint32Array; - + from(source: ArrayLike): Uint32Array; /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => number, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Uint32Array; } -declare var Uint32Array: Uint32ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint32Array; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ +declare var Uint32Array: Uint32ArrayConstructor; interface Float32Array { /** * The size in bytes of each element in the array. @@ -4965,7 +5619,6 @@ interface Float32Array { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -4974,9 +5627,14 @@ interface Float32Array { * @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. */ - every( - predicate: (value: number, index: number, array: Float32Array) => unknown, - thisArg?: any + every( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -4988,7 +5646,6 @@ interface Float32Array { * length+end. */ fill(value: number, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -4996,11 +5653,15 @@ interface Float32Array { * @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. */ - filter( - predicate: (value: number, index: number, array: Float32Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): Float32Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -5010,11 +5671,10 @@ interface Float32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: number, index: number, obj: Float32Array) => boolean, - thisArg?: any + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -5024,11 +5684,10 @@ interface Float32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: number, index: number, obj: Float32Array) => boolean, - thisArg?: any + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -5036,9 +5695,9 @@ interface Float32Array { * @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. */ - forEach( - callbackfn: (value: number, index: number, array: Float32Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -5068,7 +5727,6 @@ interface Float32Array { * The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -5077,39 +5735,30 @@ interface Float32Array { * @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. */ - map( - callbackfn: (value: number, index: number, array: Float32Array) => number, - thisArg?: any + map( + callbackfn: ( + this: This, + value: number, + index: number, + array: this + ) => number, + thisArg?: This ): Float32Array; - /** * 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. * @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. - * @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. */ - reduce( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Float32Array - ) => number - ): number; - reduce( + reduce( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Float32Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -5120,44 +5769,30 @@ interface Float32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Float32Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Float32Array - ) => number - ): number; - reduceRight( + reduceRight( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Float32Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -5168,12 +5803,12 @@ interface Float32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Float32Array + array: this ) => U, initialValue: U ): U; @@ -5196,7 +5831,6 @@ interface Float32Array { * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ slice(start?: number, end?: number): Float32Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls @@ -5205,9 +5839,14 @@ interface Float32Array { * @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. */ - some( - predicate: (value: number, index: number, array: Float32Array) => unknown, - thisArg?: any + some( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -5244,6 +5883,115 @@ interface Float32Array { [index: number]: number; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @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. +// */ +// every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @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. +// */ +// some(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; interface Float32ArrayConstructor { readonly prototype: Float32Array; @@ -5265,31 +6013,37 @@ interface Float32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): Float32Array; - + from(source: ArrayLike): Float32Array; /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => number, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Float32Array; } -declare var Float32Array: Float32ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Float32Array; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ +declare var Float32Array: Float32ArrayConstructor; interface Float64Array { /** * The size in bytes of each element in the array. @@ -5321,7 +6075,6 @@ interface Float64Array { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; - /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -5330,9 +6083,14 @@ interface Float64Array { * @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. */ - every( - predicate: (value: number, index: number, array: Float64Array) => unknown, - thisArg?: any + every( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -5344,7 +6102,6 @@ interface Float64Array { * length+end. */ fill(value: number, start?: number, end?: number): this; - /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls @@ -5352,11 +6109,15 @@ interface Float64Array { * @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. */ - filter( - predicate: (value: number, index: number, array: Float64Array) => any, - thisArg?: any + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): Float64Array; - /** * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. @@ -5366,11 +6127,10 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find( - predicate: (value: number, index: number, obj: Float64Array) => boolean, - thisArg?: any + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number | undefined; - /** * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. @@ -5380,11 +6140,10 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex( - predicate: (value: number, index: number, obj: Float64Array) => boolean, - thisArg?: any + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This ): number; - /** * Performs the specified action for each element in an array. * @param callbackfn A function that accepts up to three arguments. forEach calls the @@ -5392,9 +6151,9 @@ interface Float64Array { * @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. */ - forEach( - callbackfn: (value: number, index: number, array: Float64Array) => void, - thisArg?: any + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This ): void; /** @@ -5424,7 +6183,6 @@ interface Float64Array { * The length of the array. */ readonly length: number; - /** * Calls a defined callback function on each element of an array, and returns an array that * contains the results. @@ -5433,39 +6191,30 @@ interface Float64Array { * @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. */ - map( - callbackfn: (value: number, index: number, array: Float64Array) => number, - thisArg?: any + map( + callbackfn: ( + this: This, + value: number, + index: number, + array: this + ) => number, + thisArg?: This ): Float64Array; - /** * 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. * @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. - * @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. */ - reduce( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Float64Array - ) => number - ): number; - reduce( + reduce( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Float64Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -5476,44 +6225,30 @@ interface Float64Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce( + reduce( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Float64Array + array: this ) => U, initialValue: U ): U; - /** * 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. * @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. - * @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. */ - reduceRight( + reduceRight( callbackfn: ( - previousValue: number, + previousValue: number | U, currentValue: number, currentIndex: number, - array: Float64Array - ) => number - ): number; - reduceRight( - callbackfn: ( - previousValue: number, - currentValue: number, - currentIndex: number, - array: Float64Array - ) => number, - initialValue: number - ): number; - + array: this + ) => U + ): number | U; /** * 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 @@ -5524,12 +6259,12 @@ interface Float64Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight( + reduceRight( callbackfn: ( previousValue: U, currentValue: number, currentIndex: number, - array: Float64Array + array: this ) => U, initialValue: U ): U; @@ -5552,7 +6287,6 @@ interface Float64Array { * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ slice(start?: number, end?: number): Float64Array; - /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls @@ -5561,9 +6295,14 @@ interface Float64Array { * @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. */ - some( - predicate: (value: number, index: number, array: Float64Array) => unknown, - thisArg?: any + some( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This ): boolean; /** @@ -5591,6 +6330,115 @@ interface Float64Array { [index: number]: number; } +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @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. +// */ +// every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @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. +// * @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. +// */ +// filter(predicate: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @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. +// */ +// forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @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. +// * @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. +// */ +// map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; +// /** +// * 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. +// * @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. +// * @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. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @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. +// */ +// some(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; interface Float64ArrayConstructor { readonly prototype: Float64Array; @@ -5612,25 +6460,36 @@ interface Float64ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; - /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. */ - from(arrayLike: ArrayLike): Float64Array; - + from(source: ArrayLike): Float64Array; /** * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. + * @param source An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from( - arrayLike: ArrayLike, - mapfn: (v: T, k: number) => number, - thisArg?: any + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This ): Float64Array; } +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Float64Array; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; + declare var Float64Array: Float64ArrayConstructor; ///////////////////////////// @@ -5829,6 +6688,8 @@ type UnionToIntersection = ( ? F : unknown; +type CheckNonNullable = [T] extends [NonNullable] ? U : never; + type JSONValue = | null | string diff --git a/lib/lib.es2015.collection.d.ts b/lib/lib.es2015.collection.d.ts index 7891008..e409e66 100644 --- a/lib/lib.es2015.collection.d.ts +++ b/lib/lib.es2015.collection.d.ts @@ -1,6 +1,6 @@ interface Map { forEach( - callbackfn: (this: This, value: V, key: K, map: Map) => void, + callbackfn: (this: This, value: V, key: K, map: this) => void, thisArg?: This ): void; } @@ -19,14 +19,14 @@ interface WeakMapConstructor { interface ReadonlyMap { forEach( - callbackfn: (this: This, value: V, key: K, map: ReadonlyMap) => void, + callbackfn: (this: This, value: V, key: K, map: this) => void, thisArg?: This ): void; } interface Set { forEach( - callbackfn: (this: This, value: T, value2: T, set: Set) => void, + callbackfn: (this: This, value: T, value2: T, set: this) => void, thisArg?: This ): void; } @@ -38,7 +38,7 @@ interface SetConstructor { interface ReadonlySet { forEach( - callbackfn: (this: This, value: T, value2: T, set: ReadonlySet) => void, + callbackfn: (this: This, value: T, value2: T, set: this) => void, thisArg?: This ): void; } diff --git a/lib/lib.es2015.core.d.ts b/lib/lib.es2015.core.d.ts index 3ae840c..98855ab 100644 --- a/lib/lib.es2015.core.d.ts +++ b/lib/lib.es2015.core.d.ts @@ -1,3 +1,67 @@ +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find( + predicate: (this: This, value: T, index: number, obj: this) => value is S, + thisArg?: This + ): S | undefined; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find( + predicate: (this: This, value: T, index: number, obj: this) => boolean, + thisArg?: This + ): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex( + predicate: (this: This, value: T, index: number, obj: this) => boolean, + thisArg?: This + ): number; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: ArrayLike): T[]; + + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => U, + thisArg?: This + ): U[]; +} + interface NumberConstructor { /** * Returns true if passed value is finite. @@ -38,7 +102,10 @@ interface ObjectConstructor { assign( target: T, ...sources: Ts - ): First>; + ): CheckNonNullable< + T, + First> + >; /** * Returns true if the values are the same value, false otherwise. @@ -62,6 +129,50 @@ interface ObjectConstructor { setPrototypeOf(o: T, proto: null): T; } +interface ReadonlyArray { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find( + predicate: (this: This, value: T, index: number, obj: this) => value is S, + thisArg?: This + ): S | undefined; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find( + predicate: (this: This, value: T, index: number, obj: this) => boolean, + thisArg?: This + ): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex( + predicate: (this: This, value: T, index: number, obj: this) => boolean, + thisArg?: This + ): number; +} + interface String { /** * Returns the String value result of normalizing the string into the normalization form diff --git a/lib/lib.es2015.iterable.d.ts b/lib/lib.es2015.iterable.d.ts index de382cc..fbb06b4 100644 --- a/lib/lib.es2015.iterable.d.ts +++ b/lib/lib.es2015.iterable.d.ts @@ -9,6 +9,26 @@ interface IterableIterator extends Iterator { [Symbol.iterator](): IterableIterator; } +interface ArrayConstructor { + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): T[]; + + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => U, + thisArg?: This + ): U[]; +} + interface IArguments { /** Iterator */ [Symbol.iterator](): IterableIterator; @@ -35,3 +55,22 @@ interface PromiseConstructor { interface MapConstructor { new (iterable?: Iterable | null): Map; } + +interface TypedNumberArrayConstructor { + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: Iterable | ArrayLike): TypedNumberArray; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from( + source: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This + ): TypedNumberArray; +} diff --git a/lib/lib.es2017.object.d.ts b/lib/lib.es2017.object.d.ts index 81fbf03..9de9db4 100644 --- a/lib/lib.es2017.object.d.ts +++ b/lib/lib.es2017.object.d.ts @@ -13,7 +13,7 @@ interface ObjectConstructor { * Returns an array of values of the enumerable properties of an object * @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. */ - values(o: unknown): unknown[]; + values(o: T): CheckNonNullable; /** * Returns an array of key/values of the enumerable properties of an object @@ -29,5 +29,16 @@ interface ObjectConstructor { * Returns an array of key/values of the enumerable properties of an object * @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. */ - entries(o: T): [string, unknown][]; + entries(o: T): CheckNonNullable; + + /** + * Returns an object containing all own property descriptors of an object + * @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. + */ + getOwnPropertyDescriptors(o: T): CheckNonNullable< + T, + { [P in keyof T]: TypedPropertyDescriptor } & { + [x: string]: PropertyDescriptor; + } + >; } diff --git a/lib/lib.es2020.bigint.d.ts b/lib/lib.es2020.bigint.d.ts new file mode 100644 index 0000000..bd161ab --- /dev/null +++ b/lib/lib.es2020.bigint.d.ts @@ -0,0 +1,203 @@ +interface TypedBigIntArray { + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns false, + * or until the end of the array. + * @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. + */ + every( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This + ): boolean; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ + filter( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This + ): TypedBigIntArray; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This + ): bigint | undefined; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This + ): number; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach( + callbackfn: (this: This, value: bigint, index: number, array: this) => void, + thisArg?: This + ): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map( + callbackfn: ( + this: This, + value: bigint, + index: number, + array: this + ) => bigint, + thisArg?: This + ): TypedBigIntArray; + /** + * 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. + * @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. + */ + reduce( + callbackfn: ( + previousValue: bigint | U, + currentValue: bigint, + currentIndex: number, + array: this + ) => U + ): bigint | U; + /** + * 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. + * @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. + * @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. + */ + reduce( + callbackfn: ( + previousValue: U, + currentValue: bigint, + currentIndex: number, + array: this + ) => U, + initialValue: U + ): U; + /** + * 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. + * @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. + */ + reduceRight( + callbackfn: ( + previousValue: bigint | U, + currentValue: bigint, + currentIndex: number, + array: this + ) => U + ): bigint | U; + /** + * 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. + * @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. + * @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. + */ + reduceRight( + callbackfn: ( + previousValue: U, + currentValue: bigint, + currentIndex: number, + array: this + ) => U, + initialValue: U + ): U; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls the + * predicate function for each element in the array until the predicate returns true, or until + * the end of the array. + * @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. + */ + some( + predicate: ( + this: This, + value: bigint, + index: number, + array: this + ) => boolean, + thisArg?: This + ): boolean; +} + +interface TypedBigIntArrayConstructor { + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: Iterable | ArrayLike): TypedBigIntArray; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from( + arrayLike: Iterable | ArrayLike, + mapfn: (this: This, v: T, k: number) => bigint, + thisArg?: This + ): TypedBigIntArray; +} diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts index d7d4350..0d9d716 100644 --- a/lib/lib.es5.d.ts +++ b/lib/lib.es5.d.ts @@ -6,6 +6,8 @@ type UnionToIntersection = ( ? F : unknown; +type CheckNonNullable = [T] extends [NonNullable] ? U : never; + /** * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. @@ -39,14 +41,25 @@ interface ObjectConstructor { * Returns the prototype of an object. * @param o The object that references the prototype. */ - getPrototypeOf(o: any): unknown; + getPrototypeOf(o: T): CheckNonNullable; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor( + o: T, + p: PropertyKey + ): CheckNonNullable; /** * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ - getOwnPropertyNames(o: O): O extends undefined | null ? never : string[]; + getOwnPropertyNames(o: T): CheckNonNullable; /** * Creates an object that has the specified prototype or that has null prototype. @@ -156,34 +169,6 @@ interface CallableFunction extends Function { } interface NewableFunction extends Function { - /** - * Calls the function with the specified object as the this value and the elements of specified array as the arguments. - * @param thisArg The object to be used as the this object. - */ - apply(this: new () => T, thisArg: T): void; - - /** - * Calls the function with the specified object as the this value and the elements of specified array as the arguments. - * @param thisArg The object to be used as the this object. - * @param args An array of argument values to be passed to the function. - */ - apply( - this: new (...args: A) => T, - thisArg: T, - args: A - ): void; - - /** - * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. - * @param thisArg The object to be used as the this object. - * @param args Argument values to be passed to the function. - */ - call( - this: new (...args: A) => T, - thisArg: T, - ...args: A - ): void; - /** * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. @@ -322,14 +307,9 @@ interface ReadonlyArray { * If thisArg is omitted, undefined is used as the this value. */ every( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => value is S, + predicate: (this: This, value: T, index: number, array: this) => value is S, thisArg?: This - ): this is readonly S[]; + ): this is { [K in keyof this]: S }; /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -339,12 +319,7 @@ interface ReadonlyArray { * If thisArg is omitted, undefined is used as the this value. */ every( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): boolean; /** @@ -356,12 +331,7 @@ interface ReadonlyArray { * If thisArg is omitted, undefined is used as the this value. */ some( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): boolean; /** @@ -370,12 +340,7 @@ interface ReadonlyArray { * @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. */ forEach( - callbackfn: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => void, + callbackfn: (this: This, value: T, index: number, array: this) => void, thisArg?: This ): void; /** @@ -384,21 +349,16 @@ interface ReadonlyArray { * @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. */ map( - callbackfn: (this: This, value: T, index: number, array: readonly T[]) => U, + callbackfn: (this: This, value: T, index: number, array: this) => U, thisArg?: This - ): U[]; + ): { -readonly [K in keyof this]: U }; /** * Returns the elements of an array that meet the condition specified in a callback function. * @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. * @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. */ filter( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => value is S, + predicate: (this: This, value: T, index: number, array: this) => value is S, thisArg?: This ): S[]; /** @@ -407,32 +367,64 @@ interface ReadonlyArray { * @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. */ filter( - predicate: ( - this: This, - value: T, - index: number, - array: readonly T[] - ) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): T[]; + /** + * 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. + * @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. + */ + reduce( + callbackfn: ( + previousValue: T | U, + currentValue: T, + currentIndex: number, + array: this + ) => U + ): T | U; + /** + * 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. + * @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. + * @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. + */ + reduce( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, + array: this + ) => U, + initialValue: U + ): U; + /** + * 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. + * @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. + */ + reduceRight( + callbackfn: ( + previousValue: T | U, + currentValue: T, + currentIndex: number, + array: this + ) => U + ): T | U; + /** + * 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. + * @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. + * @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. + */ + reduceRight( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, + array: this + ) => U, + initialValue: U + ): U; } interface Array { - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @returns An array containing the elements that were deleted. - */ - splice(start: number, deleteCount?: number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - * @returns An array containing the elements that were deleted. - */ - splice(start: number, deleteCount: number, ...items: T[]): this; /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -442,9 +434,9 @@ interface Array { * If thisArg is omitted, undefined is used as the this value. */ every( - predicate: (this: This, value: T, index: number, array: T[]) => value is S, + predicate: (this: This, value: T, index: number, array: this) => value is S, thisArg?: This - ): this is S[]; + ): this is { [K in keyof this]: S }; /** * Determines whether all the members of an array satisfy the specified test. * @param predicate A function that accepts up to three arguments. The every method calls @@ -454,7 +446,7 @@ interface Array { * If thisArg is omitted, undefined is used as the this value. */ every( - predicate: (this: This, value: T, index: number, array: T[]) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): boolean; /** @@ -466,7 +458,7 @@ interface Array { * If thisArg is omitted, undefined is used as the this value. */ some( - predicate: (this: This, value: T, index: number, array: T[]) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): boolean; /** @@ -475,7 +467,7 @@ interface Array { * @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. */ forEach( - callbackfn: (this: This, value: T, index: number, array: T[]) => void, + callbackfn: (this: This, value: T, index: number, array: this) => void, thisArg?: This ): void; /** @@ -484,16 +476,16 @@ interface Array { * @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. */ map( - callbackfn: (this: This, value: T, index: number, array: T[]) => U, + callbackfn: (this: This, value: T, index: number, array: this) => U, thisArg?: This - ): U[]; + ): { [K in keyof this]: U }; /** * Returns the elements of an array that meet the condition specified in a callback function. * @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. * @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. */ filter( - predicate: (this: This, value: T, index: number, array: T[]) => value is S, + predicate: (this: This, value: T, index: number, array: this) => value is S, thisArg?: This ): S[]; /** @@ -502,9 +494,61 @@ interface Array { * @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. */ filter( - predicate: (this: This, value: T, index: number, array: T[]) => boolean, + predicate: (this: This, value: T, index: number, array: this) => boolean, thisArg?: This ): T[]; + /** + * 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. + * @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. + */ + reduce( + callbackfn: ( + previousValue: T | U, + currentValue: T, + currentIndex: number, + array: this + ) => U + ): T | U; + /** + * 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. + * @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. + * @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. + */ + reduce( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, + array: this + ) => U, + initialValue: U + ): U; + /** + * 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. + * @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. + */ + reduceRight( + callbackfn: ( + previousValue: T | U, + currentValue: T, + currentIndex: number, + array: this + ) => U + ): T | U; + /** + * 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. + * @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. + * @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. + */ + reduceRight( + callbackfn: ( + previousValue: U, + currentValue: T, + currentIndex: number, + array: this + ) => U, + initialValue: U + ): U; } interface ArrayConstructor { @@ -528,3 +572,197 @@ declare type PromiseConstructorLike = new ( reject: (reason?: any) => void ) => void ) => PromiseLike; + +interface TypedNumberArray { + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @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. + */ + every( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This + ): boolean; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @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. + * @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. + */ + filter( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This + ): TypedNumberArray; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This + ): number | undefined; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex( + predicate: (this: This, value: number, index: number, obj: this) => boolean, + thisArg?: This + ): number; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach( + callbackfn: (this: This, value: number, index: number, array: this) => void, + thisArg?: This + ): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map( + callbackfn: ( + this: This, + value: number, + index: number, + array: this + ) => number, + thisArg?: This + ): TypedNumberArray; + /** + * 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. + * @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. + */ + reduce( + callbackfn: ( + previousValue: number | U, + currentValue: number, + currentIndex: number, + array: this + ) => U + ): number | U; + /** + * 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. + * @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. + * @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. + */ + reduce( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, + array: this + ) => U, + initialValue: U + ): U; + /** + * 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. + * @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. + */ + reduceRight( + callbackfn: ( + previousValue: number | U, + currentValue: number, + currentIndex: number, + array: this + ) => U + ): number | U; + /** + * 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. + * @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. + * @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. + */ + reduceRight( + callbackfn: ( + previousValue: U, + currentValue: number, + currentIndex: number, + array: this + ) => U, + initialValue: U + ): U; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @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. + */ + some( + predicate: ( + this: This, + value: number, + index: number, + array: this + ) => boolean, + thisArg?: This + ): boolean; +} + +interface TypedNumberArrayConstructor { + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. + */ + from(source: ArrayLike): TypedNumberArray; + /** + * Creates an array from an array-like or iterable object. + * @param source An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from( + source: ArrayLike, + mapfn: (this: This, v: T, k: number) => number, + thisArg?: This + ): TypedNumberArray; +} diff --git a/tests/src/es2015.core.ts b/tests/src/es2015.core.ts index 7ad149a..bec0f1a 100644 --- a/tests/src/es2015.core.ts +++ b/tests/src/es2015.core.ts @@ -1,4 +1,20 @@ -import { expectType } from "tsd"; +import { expectError, expectType } from "tsd"; + +// ReadonlyArray +{ + // https://github.com/uhyo/better-typescript-lib/issues/7 + const a1: readonly number[] = [1, 2, 3]; + expectError(a1.find((x) => x)); + expectError(a1.findIndex((x) => x)); +} + +// Array +{ + // https://github.com/uhyo/better-typescript-lib/issues/7 + const a1: number[] = [1, 2, 3]; + expectError(a1.find((x) => x)); + expectError(a1.findIndex((x) => x)); +} // NumberConstructor { @@ -17,8 +33,10 @@ import { expectType } from "tsd"; expectType(n); } } + // ObjectConstructor { + expectType(Object.assign(null)); const obj1 = Object.assign({ foo: 123 }); expectType<{ foo: number }>(obj1); const obj2 = Object.assign({ foo: 123 }, { bar: "wow" }); diff --git a/tests/src/es2017.object.ts b/tests/src/es2017.object.ts index 007a050..904f8bb 100644 --- a/tests/src/es2017.object.ts +++ b/tests/src/es2017.object.ts @@ -8,6 +8,10 @@ function createGenericRecord( } { + expectType(Object.values(null)); + expectType(Object.entries(null)); + expectType(Object.getOwnPropertyDescriptors(null)); + const obj1: { [k: string]: number } = { foo: 123 }; const values1 = Object.values(obj1); const entries1 = Object.entries(obj1); diff --git a/tests/src/es2020.bigint.ts b/tests/src/es2020.bigint.ts new file mode 100644 index 0000000..8f05e40 --- /dev/null +++ b/tests/src/es2020.bigint.ts @@ -0,0 +1,12 @@ +import { expectError } from "tsd"; +// TypedNumberArray +{ + for (const TypedBigIntArray of [BigInt64Array, BigUint64Array]) { + const a1 = new TypedBigIntArray(); + expectError(a1.filter((x) => x)); + expectError(a1.every((x) => x)); + expectError(a1.some((x) => x)); + expectError(a1.find((x) => x)); + expectError(a1.findIndex((x) => x)); + } +} diff --git a/tests/src/es5.ts b/tests/src/es5.ts index 3bd7890..972bfa5 100644 --- a/tests/src/es5.ts +++ b/tests/src/es5.ts @@ -6,9 +6,16 @@ expectType(eval("foo")); expectType<{}>(Object()); expectType<{ foo: number }>(Object({ foo: 123 })); expectType<{}>(Object(123)); -// $ExpctType unknown +// Object.getPrototypeOf expectType(Object.getPrototypeOf([])); +expectType(Object.getPrototypeOf(null)); +// Object.getOwnPropertyDescriptor +expectType( + Object.getOwnPropertyDescriptor([], "foo") +); +expectType(Object.getOwnPropertyDescriptor(null, "foo")); // Object.getOwnPropertyNames +expectType(Object.getOwnPropertyNames([])); expectType(Object.getOwnPropertyNames(null)); // Object.create expectType<{}>(Object.create(null)); @@ -177,30 +184,78 @@ expectType<{ foo: number; bar: string; baz: boolean }>( { // https://github.com/uhyo/better-typescript-lib/issues/7 const a1: readonly number[] = [1, 2, 3]; - expectType(a1.filter((a1) => a1 > 2)); + expectType(a1.filter((x) => x > 2)); expectType<1[]>(a1.filter((x): x is 1 => x === 1)); if (a1.every((x): x is 2 => x === 2)) { expectType(a1); } + expectType( + a1.reduce((x) => { + expectType(x); + return "foo"; + }) + ); + expectType( + a1.reduce((x) => { + expectType(x); + return "foo"; + }, "foo") + ); + expectType(a1.reduceRight); expectError(a1.filter((x) => x)); expectError(a1.every((x) => x)); expectError(a1.some((x) => x)); + + const a2: readonly [number, number, number] = [1, 2, 3]; + if ( + a2.every((x, i, a3): x is 2 => { + expectType(a3); + return x === 2; + }) + ) { + expectType(a2); + } + expectType<[string, string, string]>(a2.map(() => "foo")); } // Array { // https://github.com/uhyo/better-typescript-lib/issues/7 const a1: number[] = [1, 2, 3]; - expectType(a1.filter((a1) => a1 > 2)); + expectType(a1.filter((x) => x > 2)); expectType<1[]>(a1.filter((x): x is 1 => x === 1)); if (a1.every((x): x is 2 => x === 2)) { expectType<2[]>(a1); } + expectType( + a1.reduce((x) => { + expectType(x); + return "foo"; + }) + ); + expectType( + a1.reduce((x) => { + expectType(x); + return "foo"; + }, "foo") + ); + expectType(a1.reduceRight); expectError(a1.filter((x) => x)); expectError(a1.every((x) => x)); expectError(a1.some((x) => x)); + + const a2: [number, number, number] = [1, 2, 3]; + if ( + a2.every((x, i, a3): x is 2 => { + expectType(a3); + return x === 2; + }) + ) { + expectType<[2, 2, 2]>(a2); + } + expectType<[string, string, string]>(a2.map(() => "foo")); } // ArrayConstructor @@ -232,4 +287,26 @@ expectType<{ foo: number; bar: string; baz: boolean }>( } } +// TypedNumberArray +{ + for (const TypedNumberArray of [ + Int8Array, + Uint8Array, + Uint8ClampedArray, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array, + ]) { + const a1 = new TypedNumberArray(); + expectError(a1.filter((x) => x)); + expectError(a1.every((x) => x)); + expectError(a1.some((x) => x)); + expectError(a1.find((x) => x)); + expectError(a1.findIndex((x) => x)); + } +} + export {}; From 651acad2d94bb5c93889af4a3f4757bde9f66d9e Mon Sep 17 00:00:00 2001 From: graphemecluster Date: Sat, 18 Jun 2022 12:05:32 +0800 Subject: [PATCH 2/3] Restore Interface Documentation --- build/logic/generate.ts | 16 +- docs/diff/es2015.collection.d.ts.md | 18 +- docs/diff/es2015.core.d.ts.md | 47 +-- docs/diff/es2015.iterable.d.ts.md | 93 ++--- docs/diff/es2015.symbol.wellknown.d.ts.md | 34 +- docs/diff/es2019.object.d.ts.md | 5 +- docs/diff/es2020.bigint.d.ts.md | 79 +--- docs/diff/es5.d.ts.md | 437 +++++---------------- generated/lib.es2015.collection.d.ts | 4 + generated/lib.es2015.core.d.ts | 2 + generated/lib.es2015.iterable.d.ts | 13 + generated/lib.es2015.symbol.wellknown.d.ts | 3 + generated/lib.es2019.object.d.ts | 2 + generated/lib.es2020.bigint.d.ts | 10 + generated/lib.es5.d.ts | 54 +++ 15 files changed, 266 insertions(+), 551 deletions(-) diff --git a/build/logic/generate.ts b/build/logic/generate.ts index 81457d1..1ae4f72 100644 --- a/build/logic/generate.ts +++ b/build/logic/generate.ts @@ -28,11 +28,7 @@ export function generate( const replacementTargets = scanBetterFile(printer, libFile); if (replacementTargets.size === 0) { - for (const statement of originalFile.statements) { - result += statement.getFullText(originalFile); - } - result += originalFile.text.slice(originalFile.endOfFileToken.pos); - return result; + return originalFile.text; } const consumedReplacements = new Set(); @@ -133,7 +129,7 @@ export function generate( }, ]; }); - result += printInterface(printer, statement, memberList); + result += printInterface(printer, statement, memberList, originalFile); if (emitOriginalAsComment) { result += "\n"; @@ -327,10 +323,12 @@ function isPartialReplacement( function printInterface( printer: ts.Printer, originalNode: ts.InterfaceDeclaration, - members: readonly { text: string }[] + members: readonly { text: string }[], + originalSourceFile: ts.SourceFile ): string { - const originalSourceFile = originalNode.getSourceFile(); - let result = ""; + let result = originalNode + .getFullText(originalSourceFile) + .slice(0, originalNode.getLeadingTriviaWidth(originalSourceFile)); for (const dec of originalNode.decorators ?? []) { result += printer.printNode( ts.EmitHint.Unspecified, diff --git a/docs/diff/es2015.collection.d.ts.md b/docs/diff/es2015.collection.d.ts.md index b023205..a63c782 100644 --- a/docs/diff/es2015.collection.d.ts.md +++ b/docs/diff/es2015.collection.d.ts.md @@ -5,7 +5,7 @@ Index: es2015.collection.d.ts =================================================================== --- es2015.collection.d.ts +++ es2015.collection.d.ts -@@ -1,28 +1,25 @@ +@@ -1,28 +1,27 @@ interface Map { clear(): void; delete(key: K): boolean; @@ -21,7 +21,7 @@ Index: es2015.collection.d.ts set(key: K, value: V): this; readonly size: number; } -- + interface MapConstructor { - new (): Map; new (entries?: readonly (readonly [K, V])[] | null): Map; @@ -29,7 +29,7 @@ Index: es2015.collection.d.ts + readonly prototype: Map; } declare var Map: MapConstructor; -- + interface ReadonlyMap { - forEach( - callbackfn: (value: V, key: K, map: ReadonlyMap) => void, @@ -41,12 +41,10 @@ Index: es2015.collection.d.ts get(key: K): V | undefined; has(key: K): boolean; readonly size: number; -@@ -33,39 +30,35 @@ - get(key: K): V | undefined; - has(key: K): boolean; +@@ -35,37 +34,37 @@ set(key: K, value: V): this; } -- + interface WeakMapConstructor { - new ( - entries?: readonly [K, V][] | null @@ -57,7 +55,7 @@ Index: es2015.collection.d.ts + readonly prototype: WeakMap; } declare var WeakMap: WeakMapConstructor; -- + interface Set { add(value: T): this; clear(): void; @@ -72,7 +70,7 @@ Index: es2015.collection.d.ts has(value: T): boolean; readonly size: number; } -- + interface SetConstructor { - new (values?: readonly T[] | null): Set; - readonly prototype: Set; @@ -80,7 +78,7 @@ Index: es2015.collection.d.ts + readonly prototype: Set; } declare var Set: SetConstructor; -- + interface ReadonlySet { - forEach( - callbackfn: (value: T, value2: T, set: ReadonlySet) => void, diff --git a/docs/diff/es2015.core.d.ts.md b/docs/diff/es2015.core.d.ts.md index d1aa0ea..f4bec93 100644 --- a/docs/diff/es2015.core.d.ts.md +++ b/docs/diff/es2015.core.d.ts.md @@ -52,12 +52,9 @@ Index: es2015.core.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -51,26 +61,25 @@ - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; +@@ -54,23 +64,23 @@ } -- + interface ArrayConstructor { /** - * Creates an array from an array-like object. @@ -88,15 +85,7 @@ Index: es2015.core.d.ts /** * Returns a new array from a set of elements. -@@ -201,44 +210,42 @@ - * @param x A numeric expression. - */ - cbrt(x: number): number; - } -- - interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 +@@ -209,36 +219,35 @@ * that is representable as a Number value, which is approximately: * 2.2204460492503130808472633361816 x 10‍−‍16. */ @@ -137,13 +126,7 @@ Index: es2015.core.d.ts /** * The value of the largest integer n such that n and n + 1 are both exactly representable as * a Number value. -@@ -267,51 +274,31 @@ - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; - } -- - interface ObjectConstructor { +@@ -273,45 +282,26 @@ /** * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. @@ -203,7 +186,7 @@ Index: es2015.core.d.ts * @param o Object to retrieve the symbols from. */ getOwnPropertySymbols(o: any): symbol[]; -@@ -326,18 +313,24 @@ +@@ -326,16 +316,23 @@ * Returns true if the values are the same value, false otherwise. * @param value1 The first value. * @param value2 The second value. @@ -226,12 +209,10 @@ Index: es2015.core.d.ts + */ + setPrototypeOf(o: T, proto: null): T; } -- + interface ReadonlyArray { /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. -@@ -346,20 +339,25 @@ +@@ -346,20 +343,25 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -268,7 +249,7 @@ Index: es2015.core.d.ts /** * Returns the index of the first element in the array where predicate is true, and -1 -@@ -369,11 +367,11 @@ +@@ -369,11 +371,11 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -283,17 +264,7 @@ Index: es2015.core.d.ts } interface RegExp { -@@ -407,9 +405,8 @@ - interface RegExpConstructor { - new (pattern: RegExp | string, flags?: string): RegExp; - (pattern: RegExp | string, flags?: string): RegExp; - } -- - interface String { - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in -@@ -433,26 +430,17 @@ +@@ -433,26 +435,17 @@ * same as the corresponding elements of this object (converted to a String) starting at * endPosition – length(this). Otherwise returns false. */ diff --git a/docs/diff/es2015.iterable.d.ts.md b/docs/diff/es2015.iterable.d.ts.md index a41372c..6fdf4fa 100644 --- a/docs/diff/es2015.iterable.d.ts.md +++ b/docs/diff/es2015.iterable.d.ts.md @@ -28,12 +28,9 @@ Index: es2015.iterable.d.ts } interface Array { -@@ -55,26 +54,25 @@ - * Returns an iterable of values in the array - */ - values(): IterableIterator; +@@ -58,23 +57,23 @@ } -- + interface ArrayConstructor { /** - * Creates an array from an iterable object. @@ -64,12 +61,9 @@ Index: es2015.iterable.d.ts } interface ReadonlyArray { -@@ -95,12 +93,11 @@ - * Returns an iterable of values in the array - */ - values(): IterableIterator; +@@ -98,9 +97,9 @@ } -- + interface IArguments { /** Iterator */ - [Symbol.iterator](): IterableIterator; @@ -78,27 +72,17 @@ Index: es2015.iterable.d.ts interface Map { /** Returns an iterable of entries in the map. */ -@@ -140,11 +137,9 @@ - * Returns an iterable of values in the map - */ +@@ -142,9 +141,8 @@ values(): IterableIterator; } -- + interface MapConstructor { - new (): Map; new (iterable?: Iterable | null): Map; } interface WeakMap {} -@@ -201,25 +196,24 @@ - new (iterable: Iterable): WeakSet; - } - - interface Promise {} -- - interface PromiseConstructor { - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises +@@ -209,17 +207,17 @@ * resolve, or rejected when any Promise is rejected. * @param values An iterable of Promises. * @returns A new Promise. @@ -118,12 +102,9 @@ Index: es2015.iterable.d.ts interface String { /** Iterator */ -@@ -240,22 +234,25 @@ - * Returns an list of values in the array - */ - values(): IterableIterator; +@@ -243,19 +241,23 @@ } -- + interface Int8ArrayConstructor { new (elements: Iterable): Int8Array; - @@ -151,12 +132,9 @@ Index: es2015.iterable.d.ts } interface Uint8Array { -@@ -272,22 +269,25 @@ - * Returns an list of values in the array - */ - values(): IterableIterator; +@@ -275,19 +277,23 @@ } -- + interface Uint8ArrayConstructor { new (elements: Iterable): Uint8Array; - @@ -184,12 +162,9 @@ Index: es2015.iterable.d.ts } interface Uint8ClampedArray { -@@ -306,22 +306,25 @@ - * Returns an list of values in the array - */ - values(): IterableIterator; +@@ -309,19 +315,23 @@ } -- + interface Uint8ClampedArrayConstructor { new (elements: Iterable): Uint8ClampedArray; - @@ -217,12 +192,9 @@ Index: es2015.iterable.d.ts } interface Int16Array { -@@ -340,22 +343,25 @@ - * Returns an list of values in the array - */ - values(): IterableIterator; +@@ -343,19 +353,23 @@ } -- + interface Int16ArrayConstructor { new (elements: Iterable): Int16Array; - @@ -250,12 +222,9 @@ Index: es2015.iterable.d.ts } interface Uint16Array { -@@ -372,22 +378,25 @@ - * Returns an list of values in the array - */ - values(): IterableIterator; +@@ -375,19 +389,23 @@ } -- + interface Uint16ArrayConstructor { new (elements: Iterable): Uint16Array; - @@ -283,12 +252,9 @@ Index: es2015.iterable.d.ts } interface Int32Array { -@@ -404,22 +413,25 @@ - * Returns an list of values in the array - */ - values(): IterableIterator; +@@ -407,19 +425,23 @@ } -- + interface Int32ArrayConstructor { new (elements: Iterable): Int32Array; - @@ -316,12 +282,9 @@ Index: es2015.iterable.d.ts } interface Uint32Array { -@@ -436,22 +448,25 @@ - * Returns an list of values in the array - */ - values(): IterableIterator; +@@ -439,19 +461,23 @@ } -- + interface Uint32ArrayConstructor { new (elements: Iterable): Uint32Array; - @@ -349,12 +312,9 @@ Index: es2015.iterable.d.ts } interface Float32Array { -@@ -468,22 +483,25 @@ - * Returns an list of values in the array - */ - values(): IterableIterator; +@@ -471,19 +497,23 @@ } -- + interface Float32ArrayConstructor { new (elements: Iterable): Float32Array; - @@ -382,12 +342,9 @@ Index: es2015.iterable.d.ts } interface Float64Array { -@@ -500,20 +518,23 @@ - * Returns an list of values in the array - */ - values(): IterableIterator; +@@ -503,17 +533,21 @@ } -- + interface Float64ArrayConstructor { new (elements: Iterable): Float64Array; - diff --git a/docs/diff/es2015.symbol.wellknown.d.ts.md b/docs/diff/es2015.symbol.wellknown.d.ts.md index 2e8f51d..3e16efd 100644 --- a/docs/diff/es2015.symbol.wellknown.d.ts.md +++ b/docs/diff/es2015.symbol.wellknown.d.ts.md @@ -5,13 +5,7 @@ Index: es2015.symbol.wellknown.d.ts =================================================================== --- es2015.symbol.wellknown.d.ts +++ es2015.symbol.wellknown.d.ts -@@ -69,22 +69,15 @@ - [Symbol.toPrimitive](hint: string): symbol; - - readonly [Symbol.toStringTag]: string; - } -- - interface Array { +@@ -75,16 +75,10 @@ /** * Returns an object whose properties have the value 'true' * when they will be absent when used in a 'with' statement. @@ -30,15 +24,7 @@ Index: es2015.symbol.wellknown.d.ts } interface Date { -@@ -156,17 +149,15 @@ - - interface PromiseConstructor { - readonly [Symbol.species]: PromiseConstructor; - } -- - interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of +@@ -164,9 +158,8 @@ * that search. * @param string A string to search within. */ @@ -48,7 +34,7 @@ Index: es2015.symbol.wellknown.d.ts * Replaces text in a string, using this regular expression. * @param string A String object or string literal whose contents matching against * this regular expression will be replaced -@@ -182,9 +173,14 @@ +@@ -182,9 +175,14 @@ * @param replacer A function that returns the replacement text. */ [Symbol.replace]( @@ -64,17 +50,7 @@ Index: es2015.symbol.wellknown.d.ts /** * Finds the position beginning first substring match in a regular expression search -@@ -211,9 +207,8 @@ - - interface RegExpConstructor { - readonly [Symbol.species]: RegExpConstructor; - } -- - interface String { - /** - * Matches a string or an object that supports being matched against, and returns an array - * containing the results of that search, or null if no matches are found. -@@ -221,12 +216,11 @@ +@@ -221,12 +219,11 @@ */ match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; @@ -88,7 +64,7 @@ Index: es2015.symbol.wellknown.d.ts */ replace( searchValue: { -@@ -243,12 +237,12 @@ +@@ -243,12 +240,12 @@ replace( searchValue: { [Symbol.replace]( diff --git a/docs/diff/es2019.object.d.ts.md b/docs/diff/es2019.object.d.ts.md index 0644860..a5e628a 100644 --- a/docs/diff/es2019.object.d.ts.md +++ b/docs/diff/es2019.object.d.ts.md @@ -5,10 +5,7 @@ Index: es2019.object.d.ts =================================================================== --- es2019.object.d.ts +++ es2019.object.d.ts -@@ -1,17 +1,9 @@ --/// -- - interface ObjectConstructor { +@@ -4,14 +4,8 @@ /** * Returns an object created by key-value entries for properties and methods * @param entries An iterable object that contains key-value entries for properties and methods. diff --git a/docs/diff/es2020.bigint.d.ts.md b/docs/diff/es2020.bigint.d.ts.md index 05b401f..abb1384 100644 --- a/docs/diff/es2020.bigint.d.ts.md +++ b/docs/diff/es2020.bigint.d.ts.md @@ -5,21 +5,7 @@ Index: es2020.bigint.d.ts =================================================================== --- es2020.bigint.d.ts +++ es2020.bigint.d.ts -@@ -228,13 +228,8 @@ - asUintN(bits: number, int: bigint): bigint; - } - - declare var BigInt: BigIntConstructor; -- --/** -- * A typed array of 64-bit signed integer values. The contents are initialized to 0. If the -- * requested number of bytes could not be allocated, an exception is raised. -- */ - interface BigInt64Array { - /** The size in bytes of each element in the array. */ - readonly BYTES_PER_ELEMENT: number; - -@@ -259,20 +254,24 @@ +@@ -259,20 +259,24 @@ copyWithin(target: number, start: number, end?: number): this; /** Yields index, value pairs for every entry in the array. */ @@ -48,7 +34,7 @@ Index: es2020.bigint.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -282,21 +281,24 @@ +@@ -282,21 +286,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -78,7 +64,7 @@ Index: es2020.bigint.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -304,13 +306,17 @@ +@@ -304,13 +311,17 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -100,7 +86,7 @@ Index: es2020.bigint.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -318,23 +324,27 @@ +@@ -318,23 +329,27 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -135,7 +121,7 @@ Index: es2020.bigint.d.ts /** * Determines whether an array includes a certain element, returning true or false as appropriate. -@@ -370,41 +380,40 @@ +@@ -370,41 +385,40 @@ lastIndexOf(searchElement: bigint, fromIndex?: number): number; /** The length of the array. */ @@ -190,7 +176,7 @@ Index: es2020.bigint.d.ts * 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. -@@ -413,37 +422,32 @@ +@@ -413,37 +427,32 @@ * @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. @@ -235,7 +221,7 @@ Index: es2020.bigint.d.ts * 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. -@@ -452,14 +456,14 @@ +@@ -452,14 +461,14 @@ * @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. @@ -252,7 +238,7 @@ Index: es2020.bigint.d.ts initialValue: U ): U; -@@ -478,20 +482,24 @@ +@@ -478,20 +487,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ @@ -281,17 +267,7 @@ Index: es2020.bigint.d.ts /** * Sorts the array. -@@ -524,9 +532,8 @@ - readonly [Symbol.toStringTag]: "BigInt64Array"; - - [index: number]: bigint; - } -- - interface BigInt64ArrayConstructor { - readonly prototype: BigInt64Array; - new (length?: number): BigInt64Array; - new (array: Iterable): BigInt64Array; -@@ -543,29 +550,27 @@ +@@ -543,20 +556,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -321,16 +297,7 @@ Index: es2020.bigint.d.ts } declare var BigInt64Array: BigInt64ArrayConstructor; -- --/** -- * A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the -- * requested number of bytes could not be allocated, an exception is raised. -- */ - interface BigUint64Array { - /** The size in bytes of each element in the array. */ - readonly BYTES_PER_ELEMENT: number; - -@@ -590,20 +595,24 @@ +@@ -590,20 +606,24 @@ copyWithin(target: number, start: number, end?: number): this; /** Yields index, value pairs for every entry in the array. */ @@ -359,7 +326,7 @@ Index: es2020.bigint.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -613,21 +622,24 @@ +@@ -613,21 +633,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -389,7 +356,7 @@ Index: es2020.bigint.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -635,13 +647,17 @@ +@@ -635,13 +658,17 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -411,7 +378,7 @@ Index: es2020.bigint.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -649,23 +665,27 @@ +@@ -649,23 +676,27 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -446,7 +413,7 @@ Index: es2020.bigint.d.ts /** * Determines whether an array includes a certain element, returning true or false as appropriate. -@@ -701,41 +721,40 @@ +@@ -701,41 +732,40 @@ lastIndexOf(searchElement: bigint, fromIndex?: number): number; /** The length of the array. */ @@ -501,7 +468,7 @@ Index: es2020.bigint.d.ts * 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. -@@ -744,37 +763,32 @@ +@@ -744,37 +774,32 @@ * @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. @@ -546,7 +513,7 @@ Index: es2020.bigint.d.ts * 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. -@@ -783,14 +797,14 @@ +@@ -783,14 +808,14 @@ * @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. @@ -563,7 +530,7 @@ Index: es2020.bigint.d.ts initialValue: U ): U; -@@ -809,20 +823,24 @@ +@@ -809,20 +834,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ @@ -592,17 +559,7 @@ Index: es2020.bigint.d.ts /** * Sorts the array. -@@ -855,9 +873,8 @@ - readonly [Symbol.toStringTag]: "BigUint64Array"; - - [index: number]: bigint; - } -- - interface BigUint64ArrayConstructor { - readonly prototype: BigUint64Array; - new (length?: number): BigUint64Array; - new (array: Iterable): BigUint64Array; -@@ -874,20 +891,23 @@ +@@ -874,20 +903,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ diff --git a/docs/diff/es5.d.ts.md b/docs/diff/es5.d.ts.md index 0bb8464..c4643a1 100644 --- a/docs/diff/es5.d.ts.md +++ b/docs/diff/es5.d.ts.md @@ -16,17 +16,7 @@ Index: es5.d.ts /** * Converts a string to an integer. * @param string A string to convert into a number. -@@ -99,9 +99,8 @@ - - interface PropertyDescriptorMap { - [key: PropertyKey]: PropertyDescriptor; - } -- - interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - -@@ -112,14 +111,25 @@ +@@ -112,14 +112,25 @@ toLocaleString(): string; /** Returns the primitive value of the specified object. */ @@ -54,12 +44,9 @@ Index: es5.d.ts /** * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. -@@ -131,78 +141,147 @@ - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; +@@ -134,75 +145,145 @@ } -- + interface ObjectConstructor { new (value?: any): Object; - (): any; @@ -224,17 +211,7 @@ Index: es5.d.ts /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. * @param o Object on which to lock the attributes. -@@ -326,9 +405,8 @@ - ? T - : T extends (...args: infer A) => infer R - ? (...args: A) => R - : T; -- - interface CallableFunction extends Function { - /** - * Calls the function with the specified object as the this value and the elements of specified array as the arguments. - * @param thisArg The object to be used as the this object. -@@ -350,49 +428,20 @@ +@@ -350,47 +431,19 @@ this: (this: T, ...args: A) => R, thisArg: T, ...args: A @@ -283,12 +260,10 @@ Index: es5.d.ts + ...args: A + ): (...args: B) => R; } -- + interface NewableFunction extends Function { /** - * Calls the function with the specified object as the this value and the elements of specified array as the arguments. - * @param thisArg The object to be used as the this object. -@@ -414,55 +463,25 @@ +@@ -414,51 +467,23 @@ this: new (...args: A) => T, thisArg: T, ...args: A @@ -337,19 +312,15 @@ Index: es5.d.ts + ...args: A + ): new (...args: B) => R; } -- + interface IArguments { - [index: number]: any; + [index: number]: unknown; length: number; callee: Function; } -- - interface String { - /** Returns a string representation of a string. */ - toString(): string; -@@ -508,24 +527,28 @@ +@@ -508,24 +533,28 @@ * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ @@ -382,17 +353,7 @@ Index: es5.d.ts /** * Finds the first substring match in a regular expression search. -@@ -1177,9 +1200,8 @@ - readonly prototype: URIError; - } - - declare var URIError: URIErrorConstructor; -- - interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. -@@ -1187,43 +1209,80 @@ +@@ -1187,32 +1216,74 @@ * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse( @@ -476,18 +437,7 @@ Index: es5.d.ts /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ - declare var JSON: JSON; -- --///////////////////////////// --/// ECMAScript Array API (specially handled by compiler) --///////////////////////////// -- - interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ -@@ -1276,23 +1335,25 @@ +@@ -1276,23 +1347,25 @@ * which is coercible to the Boolean value false, or until the end of the array. * @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. @@ -520,7 +470,7 @@ Index: es5.d.ts /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls -@@ -1300,117 +1361,99 @@ +@@ -1300,117 +1373,99 @@ * which is coercible to the Boolean value true, or until the end of the array. * @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. @@ -670,17 +620,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -1422,9 +1465,8 @@ - readonly [n: number]: T; - join(separator?: string): string; - slice(start?: number, end?: number): T[]; - } -- - interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest index in the array. - */ -@@ -1534,23 +1576,25 @@ +@@ -1534,23 +1589,25 @@ * which is coercible to the Boolean value false, or until the end of the array. * @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. @@ -713,7 +653,7 @@ Index: es5.d.ts /** * Determines whether the specified callback function returns true for any element of an array. * @param predicate A function that accepts up to three arguments. The some method calls -@@ -1558,133 +1602,112 @@ +@@ -1558,133 +1615,113 @@ * which is coercible to the Boolean value true, or until the end of the array. * @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. @@ -865,7 +805,7 @@ Index: es5.d.ts [n: number]: T; } -- + interface ArrayConstructor { - new (arrayLength?: number): any[]; new (arrayLength: number): T[]; @@ -881,7 +821,7 @@ Index: es5.d.ts declare var Array: ArrayConstructor; -@@ -1716,9 +1739,15 @@ +@@ -1716,9 +1753,15 @@ ) => void; declare type PromiseConstructorLike = new ( @@ -898,21 +838,7 @@ Index: es5.d.ts ) => void ) => PromiseLike; -@@ -2087,13 +2116,8 @@ - byteLength?: number - ): DataView; - } - declare var DataView: DataViewConstructor; -- --/** -- * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested -- * number of bytes could not be allocated an exception is raised. -- */ - interface Int8Array { - /** - * The size in bytes of each element in the array. - */ -@@ -2123,20 +2147,24 @@ +@@ -2123,20 +2166,24 @@ * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ @@ -941,7 +867,7 @@ Index: es5.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -2146,21 +2174,24 @@ +@@ -2146,21 +2193,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -971,7 +897,7 @@ Index: es5.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -2168,13 +2199,12 @@ +@@ -2168,13 +2218,12 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -988,7 +914,7 @@ Index: es5.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -2182,23 +2212,22 @@ +@@ -2182,23 +2231,22 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -1018,7 +944,7 @@ Index: es5.d.ts /** * Returns the index of the first occurrence of a value in an array. -@@ -2226,50 +2255,40 @@ +@@ -2226,50 +2274,40 @@ /** * The length of the array. */ @@ -1082,7 +1008,7 @@ Index: es5.d.ts * 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. -@@ -2278,46 +2297,32 @@ +@@ -2278,46 +2316,32 @@ * @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. @@ -1136,7 +1062,7 @@ Index: es5.d.ts * 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. -@@ -2326,14 +2331,14 @@ +@@ -2326,14 +2350,14 @@ * @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. @@ -1153,7 +1079,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -2354,20 +2359,24 @@ +@@ -2354,20 +2378,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ @@ -1182,7 +1108,7 @@ Index: es5.d.ts /** * Sorts an array. -@@ -2422,33 +2431,26 @@ +@@ -2422,25 +2450,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -1214,16 +1140,8 @@ Index: es5.d.ts ): Int8Array; } declare var Int8Array: Int8ArrayConstructor; -- --/** -- * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the -- * requested number of bytes could not be allocated an exception is raised. -- */ - interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ -@@ -2478,20 +2480,24 @@ + +@@ -2478,20 +2504,24 @@ * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ @@ -1252,7 +1170,7 @@ Index: es5.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -2501,21 +2507,24 @@ +@@ -2501,21 +2531,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -1282,7 +1200,7 @@ Index: es5.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -2523,13 +2532,12 @@ +@@ -2523,13 +2556,12 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -1299,7 +1217,7 @@ Index: es5.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -2537,23 +2545,22 @@ +@@ -2537,23 +2569,22 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -1329,7 +1247,7 @@ Index: es5.d.ts /** * Returns the index of the first occurrence of a value in an array. -@@ -2581,50 +2588,40 @@ +@@ -2581,50 +2612,40 @@ /** * The length of the array. */ @@ -1393,7 +1311,7 @@ Index: es5.d.ts * 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. -@@ -2633,46 +2630,32 @@ +@@ -2633,46 +2654,32 @@ * @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. @@ -1447,7 +1365,7 @@ Index: es5.d.ts * 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. -@@ -2681,14 +2664,14 @@ +@@ -2681,14 +2688,14 @@ * @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. @@ -1464,7 +1382,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -2709,20 +2692,24 @@ +@@ -2709,20 +2716,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ @@ -1493,17 +1411,7 @@ Index: es5.d.ts /** * Sorts an array. -@@ -2757,9 +2744,8 @@ - valueOf(): Uint8Array; - - [index: number]: number; - } -- - interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike | ArrayBufferLike): Uint8Array; -@@ -2778,33 +2764,26 @@ +@@ -2778,25 +2789,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -1535,16 +1443,8 @@ Index: es5.d.ts ): Uint8Array; } declare var Uint8Array: Uint8ArrayConstructor; -- --/** -- * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. -- * If the requested number of bytes could not be allocated an exception is raised. -- */ - interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ -@@ -2834,24 +2813,24 @@ + +@@ -2834,24 +2843,24 @@ * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ @@ -1574,7 +1474,7 @@ Index: es5.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -2861,21 +2840,24 @@ +@@ -2861,21 +2870,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -1604,7 +1504,7 @@ Index: es5.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -2883,17 +2865,12 @@ +@@ -2883,17 +2895,12 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -1625,7 +1525,7 @@ Index: es5.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -2901,31 +2878,22 @@ +@@ -2901,31 +2908,22 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -1663,7 +1563,7 @@ Index: es5.d.ts /** * Returns the index of the first occurrence of a value in an array. -@@ -2953,54 +2921,40 @@ +@@ -2953,54 +2951,40 @@ /** * The length of the array. */ @@ -1727,7 +1627,7 @@ Index: es5.d.ts * 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. -@@ -3009,46 +2963,32 @@ +@@ -3009,46 +2993,32 @@ * @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. @@ -1781,7 +1681,7 @@ Index: es5.d.ts * 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. -@@ -3057,14 +2997,14 @@ +@@ -3057,14 +3027,14 @@ * @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. @@ -1798,7 +1698,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -3085,24 +3025,24 @@ +@@ -3085,24 +3055,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ @@ -1828,17 +1728,7 @@ Index: es5.d.ts /** * Sorts an array. -@@ -3137,9 +3077,8 @@ - valueOf(): Uint8ClampedArray; - - [index: number]: number; - } -- - interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; -@@ -3158,33 +3097,26 @@ +@@ -3158,25 +3128,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -1870,16 +1760,8 @@ Index: es5.d.ts ): Uint8ClampedArray; } declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; -- --/** -- * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the -- * requested number of bytes could not be allocated an exception is raised. -- */ - interface Int16Array { - /** - * The size in bytes of each element in the array. - */ -@@ -3214,20 +3146,24 @@ + +@@ -3214,20 +3182,24 @@ * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ @@ -1908,7 +1790,7 @@ Index: es5.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -3237,21 +3173,24 @@ +@@ -3237,21 +3209,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -1938,7 +1820,7 @@ Index: es5.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -3259,13 +3198,12 @@ +@@ -3259,13 +3234,12 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -1955,7 +1837,7 @@ Index: es5.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -3273,23 +3211,22 @@ +@@ -3273,23 +3247,22 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -1985,7 +1867,7 @@ Index: es5.d.ts /** * Returns the index of the first occurrence of a value in an array. * @param searchElement The value to locate in the array. -@@ -3316,50 +3253,40 @@ +@@ -3316,50 +3289,40 @@ /** * The length of the array. */ @@ -2049,7 +1931,7 @@ Index: es5.d.ts * 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. -@@ -3368,46 +3295,32 @@ +@@ -3368,46 +3331,32 @@ * @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. @@ -2103,7 +1985,7 @@ Index: es5.d.ts * 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. -@@ -3416,14 +3329,14 @@ +@@ -3416,14 +3365,14 @@ * @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. @@ -2120,7 +2002,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -3444,20 +3357,24 @@ +@@ -3444,20 +3393,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ @@ -2149,17 +2031,7 @@ Index: es5.d.ts /** * Sorts an array. -@@ -3492,9 +3409,8 @@ - valueOf(): Int16Array; - - [index: number]: number; - } -- - interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike | ArrayBufferLike): Int16Array; -@@ -3513,33 +3429,26 @@ +@@ -3513,25 +3466,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -2191,16 +2063,8 @@ Index: es5.d.ts ): Int16Array; } declare var Int16Array: Int16ArrayConstructor; -- --/** -- * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the -- * requested number of bytes could not be allocated an exception is raised. -- */ - interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ -@@ -3569,20 +3478,24 @@ + +@@ -3569,20 +3520,24 @@ * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ @@ -2229,7 +2093,7 @@ Index: es5.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -3592,21 +3505,24 @@ +@@ -3592,21 +3547,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -2259,7 +2123,7 @@ Index: es5.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -3614,13 +3530,12 @@ +@@ -3614,13 +3572,12 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -2276,7 +2140,7 @@ Index: es5.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -3628,23 +3543,22 @@ +@@ -3628,23 +3585,22 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -2306,7 +2170,7 @@ Index: es5.d.ts /** * Returns the index of the first occurrence of a value in an array. -@@ -3672,50 +3586,40 @@ +@@ -3672,50 +3628,40 @@ /** * The length of the array. */ @@ -2370,7 +2234,7 @@ Index: es5.d.ts * 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. -@@ -3724,46 +3628,32 @@ +@@ -3724,46 +3670,32 @@ * @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. @@ -2424,7 +2288,7 @@ Index: es5.d.ts * 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. -@@ -3772,14 +3662,14 @@ +@@ -3772,14 +3704,14 @@ * @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. @@ -2441,7 +2305,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -3800,20 +3690,24 @@ +@@ -3800,20 +3732,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ @@ -2470,17 +2334,7 @@ Index: es5.d.ts /** * Sorts an array. -@@ -3848,9 +3742,8 @@ - valueOf(): Uint16Array; - - [index: number]: number; - } -- - interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike | ArrayBufferLike): Uint16Array; -@@ -3869,32 +3762,26 @@ +@@ -3869,25 +3805,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -2512,15 +2366,8 @@ Index: es5.d.ts ): Uint16Array; } declare var Uint16Array: Uint16ArrayConstructor; --/** -- * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the -- * requested number of bytes could not be allocated an exception is raised. -- */ - interface Int32Array { - /** - * The size in bytes of each element in the array. - */ -@@ -3924,20 +3811,24 @@ + /** +@@ -3924,20 +3858,24 @@ * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ @@ -2549,7 +2396,7 @@ Index: es5.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -3947,21 +3838,24 @@ +@@ -3947,21 +3885,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -2579,7 +2426,7 @@ Index: es5.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -3969,13 +3863,12 @@ +@@ -3969,13 +3910,12 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -2596,7 +2443,7 @@ Index: es5.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -3983,23 +3876,22 @@ +@@ -3983,23 +3923,22 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -2626,7 +2473,7 @@ Index: es5.d.ts /** * Returns the index of the first occurrence of a value in an array. -@@ -4027,50 +3919,40 @@ +@@ -4027,50 +3966,40 @@ /** * The length of the array. */ @@ -2690,7 +2537,7 @@ Index: es5.d.ts * 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. -@@ -4079,46 +3961,32 @@ +@@ -4079,46 +4008,32 @@ * @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. @@ -2744,7 +2591,7 @@ Index: es5.d.ts * 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. -@@ -4127,14 +3995,14 @@ +@@ -4127,14 +4042,14 @@ * @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. @@ -2761,7 +2608,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -4155,20 +4023,24 @@ +@@ -4155,20 +4070,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ @@ -2790,17 +2637,7 @@ Index: es5.d.ts /** * Sorts an array. -@@ -4203,9 +4075,8 @@ - valueOf(): Int32Array; - - [index: number]: number; - } -- - interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike | ArrayBufferLike): Int32Array; -@@ -4224,33 +4095,26 @@ +@@ -4224,25 +4143,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -2832,16 +2669,8 @@ Index: es5.d.ts ): Int32Array; } declare var Int32Array: Int32ArrayConstructor; -- --/** -- * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the -- * requested number of bytes could not be allocated an exception is raised. -- */ - interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ -@@ -4280,20 +4144,24 @@ + +@@ -4280,20 +4197,24 @@ * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ @@ -2870,7 +2699,7 @@ Index: es5.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -4303,21 +4171,24 @@ +@@ -4303,21 +4224,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -2900,7 +2729,7 @@ Index: es5.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -4325,13 +4196,12 @@ +@@ -4325,13 +4249,12 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -2917,7 +2746,7 @@ Index: es5.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -4339,23 +4209,22 @@ +@@ -4339,23 +4262,22 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -2947,7 +2776,7 @@ Index: es5.d.ts /** * Returns the index of the first occurrence of a value in an array. * @param searchElement The value to locate in the array. -@@ -4382,50 +4251,40 @@ +@@ -4382,50 +4304,40 @@ /** * The length of the array. */ @@ -3011,7 +2840,7 @@ Index: es5.d.ts * 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. -@@ -4434,46 +4293,32 @@ +@@ -4434,46 +4346,32 @@ * @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. @@ -3065,7 +2894,7 @@ Index: es5.d.ts * 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. -@@ -4482,14 +4327,14 @@ +@@ -4482,14 +4380,14 @@ * @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. @@ -3082,7 +2911,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -4510,20 +4355,24 @@ +@@ -4510,20 +4408,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ @@ -3111,17 +2940,7 @@ Index: es5.d.ts /** * Sorts an array. -@@ -4558,9 +4407,8 @@ - valueOf(): Uint32Array; - - [index: number]: number; - } -- - interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike | ArrayBufferLike): Uint32Array; -@@ -4579,33 +4427,26 @@ +@@ -4579,25 +4481,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -3153,16 +2972,8 @@ Index: es5.d.ts ): Uint32Array; } declare var Uint32Array: Uint32ArrayConstructor; -- --/** -- * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number -- * of bytes could not be allocated an exception is raised. -- */ - interface Float32Array { - /** - * The size in bytes of each element in the array. - */ -@@ -4635,20 +4476,24 @@ + +@@ -4635,20 +4535,24 @@ * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ @@ -3191,7 +3002,7 @@ Index: es5.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -4658,21 +4503,24 @@ +@@ -4658,21 +4562,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -3221,7 +3032,7 @@ Index: es5.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -4680,13 +4528,12 @@ +@@ -4680,13 +4587,12 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -3238,7 +3049,7 @@ Index: es5.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -4694,23 +4541,22 @@ +@@ -4694,23 +4600,22 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -3268,7 +3079,7 @@ Index: es5.d.ts /** * Returns the index of the first occurrence of a value in an array. -@@ -4738,50 +4584,40 @@ +@@ -4738,50 +4643,40 @@ /** * The length of the array. */ @@ -3332,7 +3143,7 @@ Index: es5.d.ts * 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. -@@ -4790,46 +4626,32 @@ +@@ -4790,46 +4685,32 @@ * @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. @@ -3386,7 +3197,7 @@ Index: es5.d.ts * 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. -@@ -4838,14 +4660,14 @@ +@@ -4838,14 +4719,14 @@ * @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. @@ -3403,7 +3214,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -4866,20 +4688,24 @@ +@@ -4866,20 +4747,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ @@ -3432,17 +3243,7 @@ Index: es5.d.ts /** * Sorts an array. -@@ -4914,9 +4740,8 @@ - valueOf(): Float32Array; - - [index: number]: number; - } -- - interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike | ArrayBufferLike): Float32Array; -@@ -4935,33 +4760,26 @@ +@@ -4935,25 +4820,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -3474,16 +3275,8 @@ Index: es5.d.ts ): Float32Array; } declare var Float32Array: Float32ArrayConstructor; -- --/** -- * A typed array of 64-bit float values. The contents are initialized to 0. If the requested -- * number of bytes could not be allocated an exception is raised. -- */ - interface Float64Array { - /** - * The size in bytes of each element in the array. - */ -@@ -4991,20 +4809,24 @@ + +@@ -4991,20 +4874,24 @@ * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ @@ -3512,7 +3305,7 @@ Index: es5.d.ts /** * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -@@ -5014,21 +4836,24 @@ +@@ -5014,21 +4901,24 @@ * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ @@ -3542,7 +3335,7 @@ Index: es5.d.ts * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -5036,13 +4861,12 @@ +@@ -5036,13 +4926,12 @@ * immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -3559,7 +3352,7 @@ Index: es5.d.ts * Returns the index of the first element in the array where predicate is true, and -1 * otherwise. * @param predicate find calls predicate once for each element of the array, in ascending -@@ -5050,23 +4874,22 @@ +@@ -5050,23 +4939,22 @@ * findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. @@ -3589,7 +3382,7 @@ Index: es5.d.ts /** * Returns the index of the first occurrence of a value in an array. -@@ -5094,50 +4917,40 @@ +@@ -5094,50 +4982,40 @@ /** * The length of the array. */ @@ -3653,7 +3446,7 @@ Index: es5.d.ts * 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. -@@ -5146,46 +4959,32 @@ +@@ -5146,46 +5024,32 @@ * @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. @@ -3707,7 +3500,7 @@ Index: es5.d.ts * 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. -@@ -5194,14 +4993,14 @@ +@@ -5194,14 +5058,14 @@ * @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. @@ -3724,7 +3517,7 @@ Index: es5.d.ts initialValue: U ): U; -@@ -5222,20 +5021,24 @@ +@@ -5222,20 +5086,24 @@ * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. */ @@ -3753,17 +3546,7 @@ Index: es5.d.ts /** * Sorts an array. -@@ -5261,9 +5064,8 @@ - valueOf(): Float64Array; - - [index: number]: number; - } -- - interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike | ArrayBufferLike): Float64Array; -@@ -5282,25 +5084,23 @@ +@@ -5282,25 +5150,23 @@ * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ @@ -3796,17 +3579,7 @@ Index: es5.d.ts } declare var Float64Array: Float64ArrayConstructor; -@@ -5434,9 +5234,8 @@ - options?: DateTimeFormatOptions - ): string[]; - }; - } -- - interface String { - /** - * Determines whether two strings are equivalent in the current or specified locale. - * @param that String to compare to target string -@@ -5491,4 +5290,24 @@ +@@ -5491,4 +5357,24 @@ locales?: string | string[], options?: Intl.DateTimeFormatOptions ): string; diff --git a/generated/lib.es2015.collection.d.ts b/generated/lib.es2015.collection.d.ts index 2f7b76e..a656a12 100644 --- a/generated/lib.es2015.collection.d.ts +++ b/generated/lib.es2015.collection.d.ts @@ -21,6 +21,7 @@ interface MapConstructor { // readonly prototype: Map; declare var Map: MapConstructor; + interface ReadonlyMap { forEach( callbackfn: (this: This, value: V, key: K, map: this) => void, @@ -38,6 +39,7 @@ interface WeakMap { has(key: K): boolean; set(key: K, value: V): this; } + interface WeakMapConstructor { new ( entries?: readonly (readonly [K, V])[] | null @@ -48,6 +50,7 @@ interface WeakMapConstructor { // readonly prototype: WeakMap; declare var WeakMap: WeakMapConstructor; + interface Set { add(value: T): this; clear(): void; @@ -69,6 +72,7 @@ interface SetConstructor { // readonly prototype: Set; declare var Set: SetConstructor; + interface ReadonlySet { forEach( callbackfn: (this: This, value: T, value2: T, set: this) => void, diff --git a/generated/lib.es2015.core.d.ts b/generated/lib.es2015.core.d.ts index c682c37..1a7c668 100644 --- a/generated/lib.es2015.core.d.ts +++ b/generated/lib.es2015.core.d.ts @@ -245,6 +245,7 @@ interface Math { */ cbrt(x: number): number; } + interface NumberConstructor { /** * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 @@ -530,6 +531,7 @@ interface RegExpConstructor { new (pattern: RegExp | string, flags?: string): RegExp; (pattern: RegExp | string, flags?: string): RegExp; } + interface String { /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point diff --git a/generated/lib.es2015.iterable.d.ts b/generated/lib.es2015.iterable.d.ts index ecfc2dd..e0f09bc 100644 --- a/generated/lib.es2015.iterable.d.ts +++ b/generated/lib.es2015.iterable.d.ts @@ -64,6 +64,7 @@ interface Array { */ values(): IterableIterator; } + interface ArrayConstructor { /** * Creates an array from an array-like or iterable object. @@ -115,6 +116,7 @@ interface ReadonlyArray { */ values(): IterableIterator; } + interface IArguments { /** Iterator */ [Symbol.iterator](): IterableIterator; @@ -161,6 +163,7 @@ interface ReadonlyMap { */ values(): IterableIterator; } + interface MapConstructor { new (iterable?: Iterable | null): Map; } @@ -222,6 +225,7 @@ interface WeakSetConstructor { } interface Promise {} + interface PromiseConstructor { /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -274,6 +278,7 @@ interface Int8Array { */ values(): IterableIterator; } + interface Int8ArrayConstructor { new (elements: Iterable): Int8Array; /** @@ -316,6 +321,7 @@ interface Uint8Array { */ values(): IterableIterator; } + interface Uint8ArrayConstructor { new (elements: Iterable): Uint8Array; /** @@ -360,6 +366,7 @@ interface Uint8ClampedArray { */ values(): IterableIterator; } + interface Uint8ClampedArrayConstructor { new (elements: Iterable): Uint8ClampedArray; /** @@ -404,6 +411,7 @@ interface Int16Array { */ values(): IterableIterator; } + interface Int16ArrayConstructor { new (elements: Iterable): Int16Array; /** @@ -446,6 +454,7 @@ interface Uint16Array { */ values(): IterableIterator; } + interface Uint16ArrayConstructor { new (elements: Iterable): Uint16Array; /** @@ -488,6 +497,7 @@ interface Int32Array { */ values(): IterableIterator; } + interface Int32ArrayConstructor { new (elements: Iterable): Int32Array; /** @@ -530,6 +540,7 @@ interface Uint32Array { */ values(): IterableIterator; } + interface Uint32ArrayConstructor { new (elements: Iterable): Uint32Array; /** @@ -572,6 +583,7 @@ interface Float32Array { */ values(): IterableIterator; } + interface Float32ArrayConstructor { new (elements: Iterable): Float32Array; /** @@ -614,6 +626,7 @@ interface Float64Array { */ values(): IterableIterator; } + interface Float64ArrayConstructor { new (elements: Iterable): Float64Array; /** diff --git a/generated/lib.es2015.symbol.wellknown.d.ts b/generated/lib.es2015.symbol.wellknown.d.ts index e009c99..95694ac 100644 --- a/generated/lib.es2015.symbol.wellknown.d.ts +++ b/generated/lib.es2015.symbol.wellknown.d.ts @@ -70,6 +70,7 @@ interface Symbol { readonly [Symbol.toStringTag]: string; } + interface Array { /** * Returns an object whose properties have the value 'true' @@ -163,6 +164,7 @@ interface Promise { interface PromiseConstructor { readonly [Symbol.species]: PromiseConstructor; } + interface RegExp { /** * Matches a string with this regular expression, and returns an array containing the results of @@ -236,6 +238,7 @@ interface RegExp { interface RegExpConstructor { readonly [Symbol.species]: RegExpConstructor; } + interface String { /** * Matches a string or an object that supports being matched against, and returns an array diff --git a/generated/lib.es2019.object.d.ts b/generated/lib.es2019.object.d.ts index c907856..4da0897 100644 --- a/generated/lib.es2019.object.d.ts +++ b/generated/lib.es2019.object.d.ts @@ -1,3 +1,5 @@ +/// + interface ObjectConstructor { /** * Returns an object created by key-value entries for properties and methods diff --git a/generated/lib.es2020.bigint.d.ts b/generated/lib.es2020.bigint.d.ts index ac6871d..1c18b69 100644 --- a/generated/lib.es2020.bigint.d.ts +++ b/generated/lib.es2020.bigint.d.ts @@ -229,6 +229,11 @@ interface BigIntConstructor { } declare var BigInt: BigIntConstructor; + +/** + * A typed array of 64-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated, an exception is raised. + */ interface BigInt64Array { /** The size in bytes of each element in the array. */ readonly BYTES_PER_ELEMENT: number; @@ -686,6 +691,11 @@ interface BigInt64ArrayConstructor { // from(arrayLike: ArrayLike, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigInt64Array; declare var BigInt64Array: BigInt64ArrayConstructor; + +/** + * A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated, an exception is raised. + */ interface BigUint64Array { /** The size in bytes of each element in the array. */ readonly BYTES_PER_ELEMENT: number; diff --git a/generated/lib.es5.d.ts b/generated/lib.es5.d.ts index 51bf39f..b92c308 100644 --- a/generated/lib.es5.d.ts +++ b/generated/lib.es5.d.ts @@ -105,6 +105,7 @@ interface PropertyDescriptor { interface PropertyDescriptorMap { [key: PropertyKey]: PropertyDescriptor; } + interface Object { /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ constructor: Function; @@ -462,6 +463,7 @@ type OmitThisParameter = unknown extends ThisParameterType : T extends (...args: infer A) => infer R ? (...args: A) => R : T; + interface CallableFunction extends Function { /** * Calls the function with the specified object as the this value and the elements of specified array as the arguments. @@ -1297,6 +1299,7 @@ interface URIErrorConstructor extends ErrorConstructor { } declare var URIError: URIErrorConstructor; + interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. @@ -1399,6 +1402,11 @@ interface JSON { * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. */ declare var JSON: JSON; + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + interface ReadonlyArray { /** * Gets the length of the array. This is a number one higher than the highest element defined in an array. @@ -1660,6 +1668,7 @@ interface ConcatArray { join(separator?: string): string; slice(start?: number, end?: number): T[]; } + interface Array { /** * Gets or sets the length of the array. This is a number one higher than the highest index in the array. @@ -2398,6 +2407,11 @@ interface DataViewConstructor { ): DataView; } declare var DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ interface Int8Array { /** * The size in bytes of each element in the array. @@ -2854,6 +2868,11 @@ interface Int8ArrayConstructor { // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; declare var Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ interface Uint8Array { /** * The size in bytes of each element in the array. @@ -3310,6 +3329,11 @@ interface Uint8ArrayConstructor { // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; declare var Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ interface Uint8ClampedArray { /** * The size in bytes of each element in the array. @@ -3766,6 +3790,11 @@ interface Uint8ClampedArrayConstructor { // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ interface Int16Array { /** * The size in bytes of each element in the array. @@ -4221,6 +4250,11 @@ interface Int16ArrayConstructor { // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; declare var Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ interface Uint16Array { /** * The size in bytes of each element in the array. @@ -4677,6 +4711,10 @@ interface Uint16ArrayConstructor { // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; declare var Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ interface Int32Array { /** * The size in bytes of each element in the array. @@ -5133,6 +5171,11 @@ interface Int32ArrayConstructor { // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; declare var Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ interface Uint32Array { /** * The size in bytes of each element in the array. @@ -5588,6 +5631,11 @@ interface Uint32ArrayConstructor { // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; declare var Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ interface Float32Array { /** * The size in bytes of each element in the array. @@ -6044,6 +6092,11 @@ interface Float32ArrayConstructor { // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; declare var Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ interface Float64Array { /** * The size in bytes of each element in the array. @@ -6623,6 +6676,7 @@ declare namespace Intl { ): string[]; }; } + interface String { /** * Determines whether two strings are equivalent in the current or specified locale. From 24898bea75165fddf74a6e9b5dae812fcf352a1f Mon Sep 17 00:00:00 2001 From: graphemecluster Date: Sun, 19 Jun 2022 09:56:12 +0800 Subject: [PATCH 3/3] Build Debugging --- .vscode/launch.json | 13 +++++++++++++ tsconfig.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d476904 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Build", + "skipFiles": ["/**"], + "program": "${workspaceFolder}/build/build.ts", + "outFiles": ["${workspaceFolder}/dist/**/*.js"] + } + ] +} diff --git a/tsconfig.json b/tsconfig.json index ea52a4f..1cd6c7c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ + "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ "outDir": "./dist", /* Redirect output structure to the directory. */ "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */