export declare type Func = (...a: T) => R; export declare type __ = null | undefined; /** * Curry 类型 * @reference * https://stackoverflow.com/q/39432234/12733140 * https://stackoverflow.com/q/51859461/12733140 */ export interface Curry1 { (): Curry1; (t1: T1): R; } export interface Curry2 { (): Curry2; (t1: T1): Curry1; (t1: T1, t2: T2): R; } export interface Curry3 { (): Curry3; (t1: T1): Curry2; (t1: T1, t2: T2): Curry1; (t1: T1, t2: T2, t3: T3): R; } export interface Curry { (fn: (t1: T1) => R): Curry1; (fn: (t1: T1, t2: T2) => R): Curry2; (fn: (t1: T1, t2: T2, t3: T3) => R): Curry3; } /** * Partial 类型 */ export declare type Partial0 = () => R; export declare type Partial1 = (t1: T1) => R; export declare type Partial2 = (t1: T1, t2: T2) => R; export declare type Partial3 = (t1: T1, t2: T2, t3: T3) => R; export interface Partial { (callback: Partial1): Partial1; (callback: Partial1, arg1: T1): Partial0; (callback: Partial2): Partial2; (callback: Partial2, arg1: T1): Partial1; (callback: Partial2, arg1: __, arg2: T2): Partial1; (callback: Partial2, arg1: T1, arg2: T2): Partial0; (callback: Partial3): Partial3; (callback: Partial3, arg1: T1): Partial2; (callback: Partial3, arg1: __, arg2: T2): Partial2; (callback: Partial3, arg1: __, arg2: __, arg3: T3): Partial2; (callback: Partial3, arg1: T1, arg2: __, arg3: T3): Partial1; (callback: Partial3, arg1: __, arg2: T2, arg3: T3): Partial1; (callback: Partial3, arg1: T1, arg2: T2): Partial1; (callback: Partial3, arg1: T1, arg2: T2, arg3: T3): Partial0; } /** * Compose 类型 * @reference * https://github.com/reduxjs/redux/blob/master/src/compose.ts * https://stackoverflow.com/q/49310886/12733140 */ export declare type Compose = { (arg: R): R; (f: F): F; (f1: (a: A) => R, f2: Func): Func; (f1: (b: B) => R, f2: (a: A) => B, f3: Func): Func; (...funcs: Function[]): (...args: any[]) => R; }; /** * Pipe 类型 * @description 与 Compose 类似, 不同点在于数据流是从左往右的 * @reference * https://github.com/microsoft/TypeScript/issues/29904 * https://dev.to/benlesh/a-simple-explanation-of-functional-pipe-in-javascript-2hbj */ export interface Pipe { (arg: R): R; (f: F): F; (f1: Func, f2: (a: A) => R): Func; (f1: Func, f2: (a: A) => B, f3: (b: B) => R): Func; (...funcs: Function[]): (...args: any[]) => R; }