Browse Source

无JIRA refactor(each): 加个重载

es6
Xavier.Meng 2 years ago
parent
commit
2b4c5600df
  1. 4
      typescript/core/base.ts

4
typescript/core/base.ts

@ -38,7 +38,9 @@ export interface _base {
size: (collection: any) => number; size: (collection: any) => number;
each: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => void) | object | string, thisArg?: any) => any; each<T>(collection: ArrayLike<T>, iteratee?: (index: number, value: T) => void, thisArg?: any): ArrayLike<T>;
each<T extends object, K extends keyof T>(collection: T, iteratee?: (index: K, value: T[K]) => void, thisArg?: any): T;
each<T>(collection: T, iteratee?: any, thisArg?: any): T;
map: <T, U>(collection: T[] | object | string | null | undefined, callback?: ((index: number, value: T) => U) | object | string, thisArg?: any) => U[]; map: <T, U>(collection: T[] | object | string | null | undefined, callback?: ((index: number, value: T) => U) | object | string, thisArg?: any) => U[];

Loading…
Cancel
Save