36 lines
1.7 KiB
TypeScript
36 lines
1.7 KiB
TypeScript
//// [implementArrayInterface.ts]
|
|
declare class MyArray<T> implements Array<T> {
|
|
toString(): string;
|
|
toLocaleString(): string;
|
|
concat<U extends T[]>(...items: U[]): T[];
|
|
concat(...items: T[]): T[];
|
|
join(separator?: string): string;
|
|
pop(): T;
|
|
push(...items: T[]): number;
|
|
reverse(): T[];
|
|
shift(): T;
|
|
slice(start?: number, end?: number): T[];
|
|
sort(compareFn?: (a: T, b: T) => number): T[];
|
|
splice(start: number): T[];
|
|
splice(start: number, deleteCount: number, ...items: T[]): T[];
|
|
unshift(...items: T[]): number;
|
|
|
|
indexOf(searchElement: T, fromIndex?: number): number;
|
|
lastIndexOf(searchElement: T, fromIndex?: number): number;
|
|
every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
|
|
some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
|
|
forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
|
|
map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
|
|
filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
|
|
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
|
|
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
|
|
reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
|
|
reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
|
|
|
|
length: number;
|
|
|
|
[n: number]: T;
|
|
}
|
|
|
|
|
|
//// [implementArrayInterface.js]
|