export type FunctionAny = (...args: any[]) => any; export type SyncFn

= (...args: P) => R; export type AsyncFn

= (...args: P) => Promise; export type SingleSyncFn = () => R; export type SingleAsyncFn = () => Promise; export type TPath = string | symbol | number; /** * 工具辅助类型 */ export type Many = T | T[]; export type WithNullable = T | null | undefined; export type PropertyName = string | number | symbol; export type ObjectPredicate = (value: T[K], key: K) => boolean; export type MapValue> = ReturnType; export type MapKey> = Parameters[0]; export type MapPredicate> = (value: MapValue, key: MapKey) => boolean; /** * 迭代参数 */ export type IterateeParam = ((value: T, ...args: any[]) => any) | PropertyName; /** * 迭代方法 */ export type StringIterator = (char: string, index: number, string: string) => R; export type ArrayIterator = (item: T, index: number, list: T[]) => R; export type ArrayLikeIterator = (item: T, index: number, list: ArrayLike) => R; export type ObjectIterator = (value: T[keyof T], key: keyof T, object: T) => R; export type ReduceStringIterator = (accumulator: R, currentValue: string, currentIndex: number, string: string) => R; export type ReduceArrayIterator = (accumulator: R, currentValue: T, currentIndex: number, list: T[]) => R; export type ReduceArrayLikeIterator = (accumulator: R, currentValue: T, currentIndex: number, list: ArrayLike) => R; export type ReduceObjectIterator = (accumulator: R, currentValue: T[keyof T], currentKey: string, object: T) => R; /** * 集合类数组 */ export type CollectionList = WithNullable>; /** * 集合对象 */ export type CollectionObject = WithNullable; /** * max、min方法 */ export interface ExtremumFunction { (array: T[], iteratee?: ArrayIterator | keyof T): T; (array: WithNullable, iteratee?: ArrayIterator): T | undefined; (array: T[], iteratee?: ArrayIterator): T; (array: WithNullable, iteratee?: ArrayIterator): T | undefined; }