Closed thomhos closed 7 years ago
Definitely. This should make it work.
interface Options<S = any> {
initialState: S
}
class MappedReducer<S> {
constructor(opts: Options<S>) {
this.initialState = opts.initialState
}
}
I'll fix it today!
Need to make sure the initial state is optional though in case we don't want to use as module. Cheers!
Fixed in pr #3
If we want to use a mapped reducer with module configuration we need to pass a default state when initialising the reducer.
Originally we would do this:
We could provide it as an argument when making the MappedReducer and set 'this.initialState' in the constructor of the MappedReducer. Then we can add the same logic as above to the .reduce method of the class.
How do you guys think about that?