1- import App from 'overmind'
1+ import App , {
2+ TAction ,
3+ TApp ,
4+ TContext ,
5+ TDerive ,
6+ TMutate ,
7+ TReaction ,
8+ } from 'overmind'
29import createConnect , { TConnect } from 'overmind-react'
3- import * as effects from './effects'
10+
411import * as actions from './actions'
12+ import * as effects from './effects'
513import * as state from './state'
614
715const config = {
@@ -10,11 +18,6 @@ const config = {
1018 state,
1119}
1220
13- declare module 'overmind' {
14- interface IState extends TState < typeof config > { }
15- interface IEffects extends TEffects < typeof config > { }
16- }
17-
1821const app = new App ( config , {
1922 devtools : false ,
2023} )
@@ -24,3 +27,32 @@ export type Connect = TConnect<typeof app>
2427export const connect = createConnect ( app )
2528
2629export default app
30+
31+ // === copy/paste
32+
33+ type IApp = TApp < typeof config >
34+ export type Action < Value = void , ReturnValue = any > = TAction <
35+ IApp ,
36+ Value ,
37+ ReturnValue
38+ >
39+
40+ export type Mutate < Value = any > = TMutate < IApp , Value >
41+
42+ export type Context < Value > = TContext < IApp , Value >
43+
44+ // Operations
45+ export namespace Operation {
46+ export type Map < Value , ReturnValue = Value > = (
47+ ctx : Context < Value >
48+ ) => ReturnValue
49+ export type Filter < Value = any > = ( ctx : Context < Value > ) => boolean
50+ export type When < Value = any > = ( ctx : Context < Value > ) => boolean
51+ export type Run < Value = any > = ( ctx : Context < Value > ) => void
52+ export type Fork < Value = any > = ( ctx : Context < Value > ) => string
53+ export type Attempt < Value , ReturnValue > = ( ctx : Context < Value > ) => ReturnValue
54+ }
55+
56+ export type Derive < Value > = TDerive < IApp , Value >
57+
58+ export type Reaction = TReaction < IApp >
0 commit comments