Simplified typing
See original GitHub issueDear 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? 😄
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:20 (6 by maintainers)
Top Results From Across the Web
Easy Home Row Words - Typing Lessons
Easy Home Row Words | Practice words, punctuation, and sentences.
Read more >Typing simplified: Leslie, Louis A - Amazon.com
Typing simplified. Typing simplified. Back. Double-tap to zoom. Hardcover $9.99. Select delivery location. See All Buying Options ...
Read more >Type Chinese using Pinyin - Simplified on Mac - Apple Support
On your Mac, enter Simplified Chinese characters using the Pinyin phonetic input codes.
Read more >Online Simplified/Traditional Chinese Input System
With this powerful tool, you can type Simplified / Traditional Chinese characters anywhere in the world with no need to install Chinese input...
Read more >Type Chinese Online - 在线中文输入
You can type Chinese on a tablet, smartphone, or PC without installing a Chinese Input Method Editor(IME)! It is fast and runs on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@christianalfoni This is all coming in V28 right? Do you have a rough release date in mind?
So a summary of what is being moved into
next
now is:New typing, no more implicit typing:
Type actions:
Operator changes:
Due to interoperable actions, the
map
,mutate
andrun
operators has been removed. Just use plain action signatureforEach
operators has also been removed as the typing never worked there (This might come back, have to research some more)fork
has new signature:parallel
now actually returns an array to the pipe with the results of each operatorReact hooks
useOvermind
is removed in favour of explicit hooks (more efficient and cleaner)useState
hook now has an added signature