We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa6d410 commit 7a669b9Copy full SHA for 7a669b9
src/compose.js renamed to src/compose.ts
@@ -9,14 +9,15 @@
9
* (...args) => f(g(h(...args))).
10
*/
11
12
-export default function compose(...funcs) {
+export default function compose(...funcs: Function[]) {
13
if (funcs.length === 0) {
14
- return arg => arg
+ // infer the argument type so it is usable in inference down the line
15
+ return <T>(arg: T) => arg
16
}
17
18
if (funcs.length === 1) {
19
return funcs[0]
20
21
- return funcs.reduce((a, b) => (...args) => a(b(...args)))
22
+ return funcs.reduce((a, b) => (...args: any) => a(b(...args)))
23
0 commit comments