diff --git a/index.d.ts b/index.d.ts index b043c71dae..88a4c0fa30 100644 --- a/index.d.ts +++ b/index.d.ts @@ -419,7 +419,8 @@ export function compose( ): Func3; /* rest */ -export function compose( - f1: (b: C) => R, f2: (a: B) => C, f3: (a: A) => B, - ...funcs: Function[] +export function compose( + f1: (b: any) => R, ...funcs: Function[] ): (...args: any[]) => R; + +export function compose(...funcs: Function[]): (...args: any[]) => R; diff --git a/test/typescript/compose.ts b/test/typescript/compose.ts index 1464add0b6..3fbb4d0dbc 100644 --- a/test/typescript/compose.ts +++ b/test/typescript/compose.ts @@ -33,3 +33,7 @@ const t10: string = compose(numberToString, stringToNumber, const t11: number = compose(stringToNumber, numberToString, stringToNumber, multiArgFn)('bar', 42, true); + + +const funcs = [stringToNumber, numberToString, stringToNumber]; +const t12 = compose(...funcs)('bar', 42, true);