Skip to content

Commit

Permalink
fix: accept more than 2 arguments in effect function
Browse files Browse the repository at this point in the history
  • Loading branch information
LiJun committed Feb 23, 2020
1 parent 3e5b6ee commit c52acca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function createStore<
Object.keys(storeEffects).forEach(fnName => {
const originalEffect = storeEffects[fnName];
// @ts-ignore
effects[fnName] = async function<A, B>(payload: A, extra?: B) {
effects[fnName] = async function<A, B>(payload: A, ...extra: B[]) {
const effectFn = {
async call<A, R>(fn: CubeState.CalledFn<A, R>, payload: A) {
const res = await fn(payload);
Expand Down Expand Up @@ -109,7 +109,7 @@ function createStore<
let result = null;
let error = null;
try {
result = await originalEffect(effectFn, payload, extra);
result = await originalEffect(effectFn, payload, ...(extra || []));
} catch (e) {
error = e;
}
Expand Down

0 comments on commit c52acca

Please sign in to comment.