{Array, TypedArray}.{copyWithin, fill, sort} return this.

This commit is contained in:
Arnavion 2016-05-07 16:28:15 -07:00
parent 73590f4fb1
commit 8bb75ec3da
2 changed files with 30 additions and 30 deletions

View File

@ -31,7 +31,7 @@ interface Array<T> {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: T, start?: number, end?: number): T[];
fill(value: T, start?: number, end?: number): this;
/**
* Returns the this object after copying a section of the array identified by start and end
@ -42,7 +42,7 @@ interface Array<T> {
* 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): T[];
copyWithin(target: number, start: number, end?: number): this;
}
interface ArrayConstructor {

56
src/lib/es5.d.ts vendored
View File

@ -1139,7 +1139,7 @@ interface Array<T> {
* Sorts an array.
* @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.
*/
sort(compareFn?: (a: T, b: T) => number): T[];
sort(compareFn?: (a: T, b: T) => number): this;
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.
@ -1481,7 +1481,7 @@ interface Int8Array {
* 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): Int8Array;
copyWithin(target: number, start: number, end?: number): this;
/**
* Determines whether all the members of an array satisfy the specified test.
@ -1501,7 +1501,7 @@ interface Int8Array {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: number, start?: number, end?: number): Int8Array;
fill(value: number, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
@ -1670,7 +1670,7 @@ interface Int8Array {
* @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.
*/
sort(compareFn?: (a: number, b: number) => number): Int8Array;
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements
@ -1754,7 +1754,7 @@ interface Uint8Array {
* 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): Uint8Array;
copyWithin(target: number, start: number, end?: number): this;
/**
* Determines whether all the members of an array satisfy the specified test.
@ -1774,7 +1774,7 @@ interface Uint8Array {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: number, start?: number, end?: number): Uint8Array;
fill(value: number, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
@ -1943,7 +1943,7 @@ interface Uint8Array {
* @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.
*/
sort(compareFn?: (a: number, b: number) => number): Uint8Array;
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements
@ -2028,7 +2028,7 @@ interface Uint8ClampedArray {
* 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): Uint8ClampedArray;
copyWithin(target: number, start: number, end?: number): this;
/**
* Determines whether all the members of an array satisfy the specified test.
@ -2048,7 +2048,7 @@ interface Uint8ClampedArray {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: number, start?: number, end?: number): Uint8ClampedArray;
fill(value: number, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
@ -2217,7 +2217,7 @@ interface Uint8ClampedArray {
* @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.
*/
sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray;
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements
@ -2301,7 +2301,7 @@ interface Int16Array {
* 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): Int16Array;
copyWithin(target: number, start: number, end?: number): this;
/**
* Determines whether all the members of an array satisfy the specified test.
@ -2321,7 +2321,7 @@ interface Int16Array {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: number, start?: number, end?: number): Int16Array;
fill(value: number, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
@ -2490,7 +2490,7 @@ interface Int16Array {
* @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.
*/
sort(compareFn?: (a: number, b: number) => number): Int16Array;
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements
@ -2575,7 +2575,7 @@ interface Uint16Array {
* 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): Uint16Array;
copyWithin(target: number, start: number, end?: number): this;
/**
* Determines whether all the members of an array satisfy the specified test.
@ -2595,7 +2595,7 @@ interface Uint16Array {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: number, start?: number, end?: number): Uint16Array;
fill(value: number, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
@ -2764,7 +2764,7 @@ interface Uint16Array {
* @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.
*/
sort(compareFn?: (a: number, b: number) => number): Uint16Array;
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements
@ -2848,7 +2848,7 @@ interface Int32Array {
* 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): Int32Array;
copyWithin(target: number, start: number, end?: number): this;
/**
* Determines whether all the members of an array satisfy the specified test.
@ -2868,7 +2868,7 @@ interface Int32Array {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: number, start?: number, end?: number): Int32Array;
fill(value: number, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
@ -3037,7 +3037,7 @@ interface Int32Array {
* @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.
*/
sort(compareFn?: (a: number, b: number) => number): Int32Array;
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements
@ -3121,7 +3121,7 @@ interface Uint32Array {
* 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): Uint32Array;
copyWithin(target: number, start: number, end?: number): this;
/**
* Determines whether all the members of an array satisfy the specified test.
@ -3141,7 +3141,7 @@ interface Uint32Array {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: number, start?: number, end?: number): Uint32Array;
fill(value: number, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
@ -3310,7 +3310,7 @@ interface Uint32Array {
* @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.
*/
sort(compareFn?: (a: number, b: number) => number): Uint32Array;
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements
@ -3394,7 +3394,7 @@ interface Float32Array {
* 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): Float32Array;
copyWithin(target: number, start: number, end?: number): this;
/**
* Determines whether all the members of an array satisfy the specified test.
@ -3414,7 +3414,7 @@ interface Float32Array {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: number, start?: number, end?: number): Float32Array;
fill(value: number, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
@ -3583,7 +3583,7 @@ interface Float32Array {
* @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.
*/
sort(compareFn?: (a: number, b: number) => number): Float32Array;
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements
@ -3668,7 +3668,7 @@ interface Float64Array {
* 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): Float64Array;
copyWithin(target: number, start: number, end?: number): this;
/**
* Determines whether all the members of an array satisfy the specified test.
@ -3688,7 +3688,7 @@ interface Float64Array {
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: number, start?: number, end?: number): Float64Array;
fill(value: number, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
@ -3857,7 +3857,7 @@ interface Float64Array {
* @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.
*/
sort(compareFn?: (a: number, b: number) => number): Float64Array;
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements