Skip to content

Commit

Permalink
fix: this.reducer typed partially correct
Browse files Browse the repository at this point in the history
  • Loading branch information
semoal committed Jun 10, 2021
1 parent dfff163 commit f43c3a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/rematchStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function createEffectsMiddleware<
next(action)

// then run the effect and return its result
return bag.effects[action.type](
return (bag.effects as any)[action.type](
action.payload,
store.getState(),
action.meta
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,14 @@ export interface ModelEffects<
[key: string]: ModelEffect<TModels>
}

export type ModelEffectThisTyped = {
[key: string]: (payload?: any, meta?: any) => Action<any, any>
}

export type ModelEffect<
TModels extends Models<TModels> = Record<string, any>
> = (
this: ModelEffectThisTyped,
payload: Action['payload'],
rootState: RematchRootState<TModels>,
meta: Action['meta']
Expand Down

0 comments on commit f43c3a7

Please sign in to comment.