Dear Overminders!
I have one thing I really want to do and that is to clean up and simplify the typing of Overmind. It was a long process figuring out how to do it and with acquired knowledge through all this work and later projects I would like to do this:
import { IContext } from 'overmind'
const config = { ... }
export interface Context extends IContext<{
state: typeof config.state,
actions: typeof config.actions,
effects: typeof config.effects
}> {}
There will be no more implicit typing, the above is what everybody will need to do. This is how you type the different things:
const myAction = (context: Context) => {}
const myActionWithPayload = (context: Context, payload: string) => {}
// Now we support generics
const myActionWithPayload = <T extends TEvent>(context: Context, payload: T) => {}
const myOperator = map((context: Context, value: string) => {})
const state: State = {
someDerived: derived((state: State, rootState: Context["state"]) => {})
}
And I believe that is it. This will need to be a breaking change to actually clean up the internal typing of Overmind. I was just wondering how you feel about this change, do you consider refactoring your apps to this typing too much work? 😄
Dear Overminders!
I have one thing I really want to do and that is to clean up and simplify the typing of Overmind. It was a long process figuring out how to do it and with acquired knowledge through all this work and later projects I would like to do this:
There will be no more implicit typing, the above is what everybody will need to do. This is how you type the different things:
And I believe that is it. This will need to be a breaking change to actually clean up the internal typing of Overmind. I was just wondering how you feel about this change, do you consider refactoring your apps to this typing too much work? 😄