From f5816963419b4270d85f5dceffc18f5933284b72 Mon Sep 17 00:00:00 2001 From: Eric Ferreira Date: Sat, 18 Mar 2023 12:15:25 -0400 Subject: [PATCH 1/2] Fix the type of `copyWithin` Only the first parameter of `copyWithin` is required, contrary to the type in the typedef. This commit fixes that type to allow correct usage of the `copyWithin` function. See [the usage of copy within](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin). --- src/lib/es2015.core.d.ts | 26 ++- src/lib/es2020.bigint.d.ts | 52 +++-- src/lib/es5.d.ts | 220 ++++++++++++------ ...ithAsClauseAndLateBoundProperty.errors.txt | 4 +- ...TypeWithAsClauseAndLateBoundProperty.types | 6 +- ...edTypeWithAsClauseAndLateBoundProperty2.js | 4 +- ...ypeWithAsClauseAndLateBoundProperty2.types | 6 +- 7 files changed, 207 insertions(+), 111 deletions(-) diff --git a/src/lib/es2015.core.d.ts b/src/lib/es2015.core.d.ts index 3b1c76c5afc3c..019bbfdf210bf 100644 --- a/src/lib/es2015.core.d.ts +++ b/src/lib/es2015.core.d.ts @@ -33,15 +33,23 @@ interface Array { fill(value: T, start?: number, end?: number): this; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * 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; + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. + */ + copyWithin(target: number, start?: number, end?: number): this; } interface ArrayConstructor { diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts index e13da87bc71c7..37845b1f98cac 100644 --- a/src/lib/es2020.bigint.d.ts +++ b/src/lib/es2020.bigint.d.ts @@ -142,15 +142,23 @@ interface BigInt64Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * 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; + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. + */ + copyWithin(target: number, start?: number, end?: number): this; /** Yields index, value pairs for every entry in the array. */ entries(): IterableIterator<[number, bigint]>; @@ -414,15 +422,23 @@ interface BigUint64Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * 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; + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. + */ + copyWithin(target: number, start?: number, end?: number): this; /** Yields index, value pairs for every entry in the array. */ entries(): IterableIterator<[number, bigint]>; diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index a74b3cb4c2111..b9d1a040b0726 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1844,15 +1844,23 @@ interface Int8Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * 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; + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. + */ + copyWithin(target: number, start?: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. @@ -2126,15 +2134,23 @@ interface Uint8Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. */ - copyWithin(target: number, start: number, end?: number): this; + copyWithin(target: number, start?: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. @@ -2408,15 +2424,23 @@ interface Uint8ClampedArray { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. */ - copyWithin(target: number, start: number, end?: number): this; + copyWithin(target: number, start?: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. @@ -2689,15 +2713,23 @@ interface Int16Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. */ - copyWithin(target: number, start: number, end?: number): this; + copyWithin(target: number, start?: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. @@ -2971,15 +3003,23 @@ interface Uint16Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. */ - copyWithin(target: number, start: number, end?: number): this; + copyWithin(target: number, start?: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. @@ -3253,15 +3293,23 @@ interface Int32Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. */ - copyWithin(target: number, start: number, end?: number): this; + copyWithin(target: number, start?: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. @@ -3535,15 +3583,23 @@ interface Uint32Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. */ - copyWithin(target: number, start: number, end?: number): this; + copyWithin(target: number, start?: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. @@ -3816,15 +3872,23 @@ interface Float32Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. */ - copyWithin(target: number, start: number, end?: number): this; + copyWithin(target: number, start?: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. @@ -4099,15 +4163,23 @@ interface Float64Array { readonly byteOffset: number; /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * 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; + * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. + * @param target Zero-based index at which to copy the sequence to, converted to an integer. + * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. + * - If `target < -array.length`, `0` is used. + * - If `target >= array.length`, nothing is copied. + * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). + * @param start Zero-based index at which to start copying elements from, converted to an integer. + * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. + * - If `start < -array.length` or `start` is omitted, `0` is used. + * - If `start >= array.length`, nothing is copied. + * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. + * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. + * - If `end < -array.length`, `0` is used. + * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. + * - If `end` is positioned before or at `start` after normalization, nothing is copied. + */ + copyWithin(target: number, start?: number, end?: number): this; /** * Determines whether all the members of an array satisfy the specified test. diff --git a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt index f12c21d1de942..afaf26aa35ada 100644 --- a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt +++ b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/mappedTypeWithAsClauseAndLateBoundProperty.ts(3,1): error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; }' but required in type 'number[]'. +tests/cases/compiler/mappedTypeWithAsClauseAndLateBoundProperty.ts(3,1): error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; }' but required in type 'number[]'. ==== tests/cases/compiler/mappedTypeWithAsClauseAndLateBoundProperty.ts (1 errors) ==== @@ -6,6 +6,6 @@ tests/cases/compiler/mappedTypeWithAsClauseAndLateBoundProperty.ts(3,1): error T declare let src2: { [K in keyof number[] as Exclude]: (number[])[K] }; tgt2 = src2; // Should error ~~~~ -!!! error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; }' but required in type 'number[]'. +!!! error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; }' but required in type 'number[]'. !!! related TS2728 /.ts/lib.es5.d.ts:--:--: 'length' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.types b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.types index 393ef58cbab5b..2cc033d0d6f58 100644 --- a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.types +++ b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.types @@ -3,10 +3,10 @@ declare let tgt2: number[]; >tgt2 : number[] declare let src2: { [K in keyof number[] as Exclude]: (number[])[K] }; ->src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } tgt2 = src2; // Should error ->tgt2 = src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>tgt2 = src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } >tgt2 : number[] ->src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } diff --git a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.js b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.js index cf4345099057c..8322df4594407 100644 --- a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.js +++ b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.js @@ -56,7 +56,7 @@ export declare const thing: { }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; - copyWithin: (target: number, start: number, end?: number) => number[]; + copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; @@ -162,7 +162,7 @@ tests/cases/compiler/mappedTypeWithAsClauseAndLateBoundProperty2.d.ts(24,118): e }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; - copyWithin: (target: number, start: number, end?: number) => number[]; + copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; diff --git a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.types b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.types index 7742d430312c5..388700b19798e 100644 --- a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.types +++ b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.types @@ -1,7 +1,7 @@ === tests/cases/compiler/mappedTypeWithAsClauseAndLateBoundProperty2.ts === export const thing = (null as any as { [K in keyof number[] as Exclude]: (number[])[K] }); ->thing : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } ->(null as any as { [K in keyof number[] as Exclude]: (number[])[K] }) : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } ->null as any as { [K in keyof number[] as Exclude]: (number[])[K] } : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>thing : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>(null as any as { [K in keyof number[] as Exclude]: (number[])[K] }) : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>null as any as { [K in keyof number[] as Exclude]: (number[])[K] } : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start?: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } >null as any : any From 8a67910c4a65bf19b012fad1363d3c79939ef867 Mon Sep 17 00:00:00 2001 From: Eric Ferreira Date: Wed, 22 Mar 2023 13:18:32 -0400 Subject: [PATCH 2/2] Remove all those JSDoc changes. --- src/lib/es2015.core.d.ts | 22 ++--- src/lib/es2020.bigint.d.ts | 44 +++------ src/lib/es5.d.ts | 198 ++++++++++++------------------------- 3 files changed, 84 insertions(+), 180 deletions(-) diff --git a/src/lib/es2015.core.d.ts b/src/lib/es2015.core.d.ts index 019bbfdf210bf..5c0a6ac3930e9 100644 --- a/src/lib/es2015.core.d.ts +++ b/src/lib/es2015.core.d.ts @@ -33,21 +33,13 @@ interface Array { fill(value: T, start?: number, end?: number): this; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; } diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts index 37845b1f98cac..a39c9056132dc 100644 --- a/src/lib/es2020.bigint.d.ts +++ b/src/lib/es2020.bigint.d.ts @@ -142,21 +142,13 @@ interface BigInt64Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; @@ -422,21 +414,13 @@ interface BigUint64Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index b9d1a040b0726..29d414ffb5d1e 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1844,21 +1844,13 @@ interface Int8Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; @@ -2134,21 +2126,13 @@ interface Uint8Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; @@ -2424,21 +2408,13 @@ interface Uint8ClampedArray { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; @@ -2713,21 +2689,13 @@ interface Int16Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; @@ -3003,21 +2971,13 @@ interface Uint16Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; @@ -3293,21 +3253,13 @@ interface Int32Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; @@ -3583,21 +3535,13 @@ interface Uint32Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; @@ -3872,21 +3816,13 @@ interface Float32Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this; @@ -4163,21 +4099,13 @@ interface Float64Array { readonly byteOffset: number; /** - * Return the `this` object after shallow copying part of the array to another location in the same array, without modifying its length. - * @param target Zero-based index at which to copy the sequence to, converted to an integer. - * - Negative index counts back from the end of the array — if `target < 0`, `target + array.length` is used. - * - If `target < -array.length`, `0` is used. - * - If `target >= array.length`, nothing is copied. - * - If `target` is positioned after `start` after normalization, copying only happens until the end of `array.length` (in other words, `copyWithin()` never extends the array). - * @param start Zero-based index at which to start copying elements from, converted to an integer. - * - Negative index counts back from the end of the array — if `start < 0`, `start + array.length` is used. - * - If `start < -array.length` or `start` is omitted, `0` is used. - * - If `start >= array.length`, nothing is copied. - * @param end Zero-based index at which to end copying elements from, converted to an integer. `copyWithin()` copies up to but not including end. - * - Negative index counts back from the end of the array — if `end < 0`, `end + array.length` is used. - * - If `end < -array.length`, `0` is used. - * - If `end >= array.length` or `end` is omitted, `array.length` is used, causing all elements until the end to be copied. - * - If `end` is positioned before or at `start` after normalization, nothing is copied. + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start?: number, end?: number): this;