Skip to content

Commit

Permalink
fix: compose - first call function does not bind this
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatAuk committed Feb 22, 2023
1 parent 7b8699e commit 8df4493
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/compose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function compose(...fns: Function[]) {
return <T extends unknown[]>(...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))
}
}

0 comments on commit 8df4493

Please sign in to comment.