redux-kotlin icon indicating copy to clipboard operation
redux-kotlin copied to clipboard

createThreadSafeStore doesn't support ReducerForActionType

Open SeanOThomas opened this issue 4 years ago • 1 comments

To create a store using createThreadSafeStore, you must provide:

typealias Reducer<State> = (state: State, action: Any) -> State

And not:

typealias ReducerForActionType<TState, TAction> = (state: TState, action: TAction) -> TState

Can we add support for the latter?

SeanOThomas avatar Oct 17 '21 21:10 SeanOThomas

I think it's okay to design this way,ReducerForActionType is designed to quickly create a sliceReducer where you know exactly the type of state and action. The reducer parameter in createThreadSafeStore may be a function that needs to combine multiple sliceReducers, so it is reasonable for its action type to be designed as any

junerver avatar Aug 18 '22 02:08 junerver