Skip to content

Commit 8bb75ec

Browse files
author
Arnavion
committed
{Array, TypedArray}.{copyWithin, fill, sort} return this.
1 parent 73590f4 commit 8bb75ec

2 files changed

Lines changed: 30 additions & 30 deletions

File tree

src/lib/es2015.core.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface Array<T> {
3131
* @param end index to stop filling the array at. If end is negative, it is treated as
3232
* length+end.
3333
*/
34-
fill(value: T, start?: number, end?: number): T[];
34+
fill(value: T, start?: number, end?: number): this;
3535

3636
/**
3737
* Returns the this object after copying a section of the array identified by start and end
@@ -42,7 +42,7 @@ interface Array<T> {
4242
* is treated as length+end.
4343
* @param end If not specified, length of the this object is used as its default value.
4444
*/
45-
copyWithin(target: number, start: number, end?: number): T[];
45+
copyWithin(target: number, start: number, end?: number): this;
4646
}
4747

4848
interface ArrayConstructor {

src/lib/es5.d.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ interface Array<T> {
11391139
* Sorts an array.
11401140
* @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
11411141
*/
1142-
sort(compareFn?: (a: T, b: T) => number): T[];
1142+
sort(compareFn?: (a: T, b: T) => number): this;
11431143
/**
11441144
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
11451145
* @param start The zero-based location in the array from which to start removing elements.
@@ -1481,7 +1481,7 @@ interface Int8Array {
14811481
* is treated as length+end.
14821482
* @param end If not specified, length of the this object is used as its default value.
14831483
*/
1484-
copyWithin(target: number, start: number, end?: number): Int8Array;
1484+
copyWithin(target: number, start: number, end?: number): this;
14851485

14861486
/**
14871487
* Determines whether all the members of an array satisfy the specified test.
@@ -1501,7 +1501,7 @@ interface Int8Array {
15011501
* @param end index to stop filling the array at. If end is negative, it is treated as
15021502
* length+end.
15031503
*/
1504-
fill(value: number, start?: number, end?: number): Int8Array;
1504+
fill(value: number, start?: number, end?: number): this;
15051505

15061506
/**
15071507
* Returns the elements of an array that meet the condition specified in a callback function.
@@ -1670,7 +1670,7 @@ interface Int8Array {
16701670
* @param compareFn The name of the function used to determine the order of the elements. If
16711671
* omitted, the elements are sorted in ascending, ASCII character order.
16721672
*/
1673-
sort(compareFn?: (a: number, b: number) => number): Int8Array;
1673+
sort(compareFn?: (a: number, b: number) => number): this;
16741674

16751675
/**
16761676
* Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements
@@ -1754,7 +1754,7 @@ interface Uint8Array {
17541754
* is treated as length+end.
17551755
* @param end If not specified, length of the this object is used as its default value.
17561756
*/
1757-
copyWithin(target: number, start: number, end?: number): Uint8Array;
1757+
copyWithin(target: number, start: number, end?: number): this;
17581758

17591759
/**
17601760
* Determines whether all the members of an array satisfy the specified test.
@@ -1774,7 +1774,7 @@ interface Uint8Array {
17741774
* @param end index to stop filling the array at. If end is negative, it is treated as
17751775
* length+end.
17761776
*/
1777-
fill(value: number, start?: number, end?: number): Uint8Array;
1777+
fill(value: number, start?: number, end?: number): this;
17781778

17791779
/**
17801780
* Returns the elements of an array that meet the condition specified in a callback function.
@@ -1943,7 +1943,7 @@ interface Uint8Array {
19431943
* @param compareFn The name of the function used to determine the order of the elements. If
19441944
* omitted, the elements are sorted in ascending, ASCII character order.
19451945
*/
1946-
sort(compareFn?: (a: number, b: number) => number): Uint8Array;
1946+
sort(compareFn?: (a: number, b: number) => number): this;
19471947

19481948
/**
19491949
* Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements
@@ -2028,7 +2028,7 @@ interface Uint8ClampedArray {
20282028
* is treated as length+end.
20292029
* @param end If not specified, length of the this object is used as its default value.
20302030
*/
2031-
copyWithin(target: number, start: number, end?: number): Uint8ClampedArray;
2031+
copyWithin(target: number, start: number, end?: number): this;
20322032

20332033
/**
20342034
* Determines whether all the members of an array satisfy the specified test.
@@ -2048,7 +2048,7 @@ interface Uint8ClampedArray {
20482048
* @param end index to stop filling the array at. If end is negative, it is treated as
20492049
* length+end.
20502050
*/
2051-
fill(value: number, start?: number, end?: number): Uint8ClampedArray;
2051+
fill(value: number, start?: number, end?: number): this;
20522052

20532053
/**
20542054
* Returns the elements of an array that meet the condition specified in a callback function.
@@ -2217,7 +2217,7 @@ interface Uint8ClampedArray {
22172217
* @param compareFn The name of the function used to determine the order of the elements. If
22182218
* omitted, the elements are sorted in ascending, ASCII character order.
22192219
*/
2220-
sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray;
2220+
sort(compareFn?: (a: number, b: number) => number): this;
22212221

22222222
/**
22232223
* Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements
@@ -2301,7 +2301,7 @@ interface Int16Array {
23012301
* is treated as length+end.
23022302
* @param end If not specified, length of the this object is used as its default value.
23032303
*/
2304-
copyWithin(target: number, start: number, end?: number): Int16Array;
2304+
copyWithin(target: number, start: number, end?: number): this;
23052305

23062306
/**
23072307
* Determines whether all the members of an array satisfy the specified test.
@@ -2321,7 +2321,7 @@ interface Int16Array {
23212321
* @param end index to stop filling the array at. If end is negative, it is treated as
23222322
* length+end.
23232323
*/
2324-
fill(value: number, start?: number, end?: number): Int16Array;
2324+
fill(value: number, start?: number, end?: number): this;
23252325

23262326
/**
23272327
* Returns the elements of an array that meet the condition specified in a callback function.
@@ -2490,7 +2490,7 @@ interface Int16Array {
24902490
* @param compareFn The name of the function used to determine the order of the elements. If
24912491
* omitted, the elements are sorted in ascending, ASCII character order.
24922492
*/
2493-
sort(compareFn?: (a: number, b: number) => number): Int16Array;
2493+
sort(compareFn?: (a: number, b: number) => number): this;
24942494

24952495
/**
24962496
* Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements
@@ -2575,7 +2575,7 @@ interface Uint16Array {
25752575
* is treated as length+end.
25762576
* @param end If not specified, length of the this object is used as its default value.
25772577
*/
2578-
copyWithin(target: number, start: number, end?: number): Uint16Array;
2578+
copyWithin(target: number, start: number, end?: number): this;
25792579

25802580
/**
25812581
* Determines whether all the members of an array satisfy the specified test.
@@ -2595,7 +2595,7 @@ interface Uint16Array {
25952595
* @param end index to stop filling the array at. If end is negative, it is treated as
25962596
* length+end.
25972597
*/
2598-
fill(value: number, start?: number, end?: number): Uint16Array;
2598+
fill(value: number, start?: number, end?: number): this;
25992599

26002600
/**
26012601
* Returns the elements of an array that meet the condition specified in a callback function.
@@ -2764,7 +2764,7 @@ interface Uint16Array {
27642764
* @param compareFn The name of the function used to determine the order of the elements. If
27652765
* omitted, the elements are sorted in ascending, ASCII character order.
27662766
*/
2767-
sort(compareFn?: (a: number, b: number) => number): Uint16Array;
2767+
sort(compareFn?: (a: number, b: number) => number): this;
27682768

27692769
/**
27702770
* Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements
@@ -2848,7 +2848,7 @@ interface Int32Array {
28482848
* is treated as length+end.
28492849
* @param end If not specified, length of the this object is used as its default value.
28502850
*/
2851-
copyWithin(target: number, start: number, end?: number): Int32Array;
2851+
copyWithin(target: number, start: number, end?: number): this;
28522852

28532853
/**
28542854
* Determines whether all the members of an array satisfy the specified test.
@@ -2868,7 +2868,7 @@ interface Int32Array {
28682868
* @param end index to stop filling the array at. If end is negative, it is treated as
28692869
* length+end.
28702870
*/
2871-
fill(value: number, start?: number, end?: number): Int32Array;
2871+
fill(value: number, start?: number, end?: number): this;
28722872

28732873
/**
28742874
* Returns the elements of an array that meet the condition specified in a callback function.
@@ -3037,7 +3037,7 @@ interface Int32Array {
30373037
* @param compareFn The name of the function used to determine the order of the elements. If
30383038
* omitted, the elements are sorted in ascending, ASCII character order.
30393039
*/
3040-
sort(compareFn?: (a: number, b: number) => number): Int32Array;
3040+
sort(compareFn?: (a: number, b: number) => number): this;
30413041

30423042
/**
30433043
* Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements
@@ -3121,7 +3121,7 @@ interface Uint32Array {
31213121
* is treated as length+end.
31223122
* @param end If not specified, length of the this object is used as its default value.
31233123
*/
3124-
copyWithin(target: number, start: number, end?: number): Uint32Array;
3124+
copyWithin(target: number, start: number, end?: number): this;
31253125

31263126
/**
31273127
* Determines whether all the members of an array satisfy the specified test.
@@ -3141,7 +3141,7 @@ interface Uint32Array {
31413141
* @param end index to stop filling the array at. If end is negative, it is treated as
31423142
* length+end.
31433143
*/
3144-
fill(value: number, start?: number, end?: number): Uint32Array;
3144+
fill(value: number, start?: number, end?: number): this;
31453145

31463146
/**
31473147
* Returns the elements of an array that meet the condition specified in a callback function.
@@ -3310,7 +3310,7 @@ interface Uint32Array {
33103310
* @param compareFn The name of the function used to determine the order of the elements. If
33113311
* omitted, the elements are sorted in ascending, ASCII character order.
33123312
*/
3313-
sort(compareFn?: (a: number, b: number) => number): Uint32Array;
3313+
sort(compareFn?: (a: number, b: number) => number): this;
33143314

33153315
/**
33163316
* Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements
@@ -3394,7 +3394,7 @@ interface Float32Array {
33943394
* is treated as length+end.
33953395
* @param end If not specified, length of the this object is used as its default value.
33963396
*/
3397-
copyWithin(target: number, start: number, end?: number): Float32Array;
3397+
copyWithin(target: number, start: number, end?: number): this;
33983398

33993399
/**
34003400
* Determines whether all the members of an array satisfy the specified test.
@@ -3414,7 +3414,7 @@ interface Float32Array {
34143414
* @param end index to stop filling the array at. If end is negative, it is treated as
34153415
* length+end.
34163416
*/
3417-
fill(value: number, start?: number, end?: number): Float32Array;
3417+
fill(value: number, start?: number, end?: number): this;
34183418

34193419
/**
34203420
* Returns the elements of an array that meet the condition specified in a callback function.
@@ -3583,7 +3583,7 @@ interface Float32Array {
35833583
* @param compareFn The name of the function used to determine the order of the elements. If
35843584
* omitted, the elements are sorted in ascending, ASCII character order.
35853585
*/
3586-
sort(compareFn?: (a: number, b: number) => number): Float32Array;
3586+
sort(compareFn?: (a: number, b: number) => number): this;
35873587

35883588
/**
35893589
* Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements
@@ -3668,7 +3668,7 @@ interface Float64Array {
36683668
* is treated as length+end.
36693669
* @param end If not specified, length of the this object is used as its default value.
36703670
*/
3671-
copyWithin(target: number, start: number, end?: number): Float64Array;
3671+
copyWithin(target: number, start: number, end?: number): this;
36723672

36733673
/**
36743674
* Determines whether all the members of an array satisfy the specified test.
@@ -3688,7 +3688,7 @@ interface Float64Array {
36883688
* @param end index to stop filling the array at. If end is negative, it is treated as
36893689
* length+end.
36903690
*/
3691-
fill(value: number, start?: number, end?: number): Float64Array;
3691+
fill(value: number, start?: number, end?: number): this;
36923692

36933693
/**
36943694
* Returns the elements of an array that meet the condition specified in a callback function.
@@ -3857,7 +3857,7 @@ interface Float64Array {
38573857
* @param compareFn The name of the function used to determine the order of the elements. If
38583858
* omitted, the elements are sorted in ascending, ASCII character order.
38593859
*/
3860-
sort(compareFn?: (a: number, b: number) => number): Float64Array;
3860+
sort(compareFn?: (a: number, b: number) => number): this;
38613861

38623862
/**
38633863
* Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements

0 commit comments

Comments
 (0)