From 8df44937dc765f40472c8ccd616ec24da3a664c0 Mon Sep 17 00:00:00 2001 From: Utopia Date: Wed, 22 Feb 2023 22:50:00 +0800 Subject: [PATCH] fix: compose - first call function does not bind this --- packages/core/src/compose.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/compose.ts b/packages/core/src/compose.ts index aa4fff5..bbe9413 100644 --- a/packages/core/src/compose.ts +++ b/packages/core/src/compose.ts @@ -27,7 +27,7 @@ export function compose(...fns: Function[]) { return (...args: T) => args const fn = fns.pop()! - return function (this: any, ...args: any[]) { - return fns.reduceRight((acc, cur) => cur.call(this, acc), fn(...args)) + return function (this: any, ...args: unknown[]) { + return fns.reduceRight((acc, cur) => cur.call(this, acc), fn.call(this, ...args)) } }