-
For some shared functionality, I need to create a function that creates a reducer function. This works fine in case of a minimal example export const withFoo =
<S, P extends PayloadAction<any>>(recipe: (state: Draft<S>) => void): CaseReducer<S, P> =>
(state) => {
recipe(state)
} But I can't get the same to work with a export const withFoo = <S, P extends PayloadAction<any>>(
recipe: (state: Draft<S>) => void
): CaseReducerWithPrepare<S, P> => {
return {
reducer(state) {
recipe(state)
},
prepare(payload: any) {
return { payload }
},
}
} When I try to add the above to my slice by ...
reducers: {
foo: withFoo((state) => {}),
...
} I get the following error for
It seems that with |
Beta Was this translation helpful? Give feedback.
Answered by
medihack
Sep 13, 2021
Replies: 1 comment
-
Just found out that it seems to be a known problem, see #1288 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
medihack
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just found out that it seems to be a known problem, see #1288