File tree Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export default defineComponent({
2323 setup() {
2424 const state = useOvermind .state ();
2525 const actions = useOvermind .actions ();
26+
2627 return { state , actions };
2728 },
2829});
Original file line number Diff line number Diff line change 1- import { IConfig , IContext } from "overmind" ;
1+ import * as actions from "./actions" ;
2+
3+ import { IConfig , IContext , IOnInitialize } from "overmind" ;
4+
5+ import { createHooks } from "overmind-vue/vue3" ;
6+ import { state } from "./state" ;
27
38export const config = {
49 state,
510 actions,
611} ;
712
13+ // Due to circular typing we have to define an
14+ // explicit typing of state, actions and effects since
15+ // TS 3.9
816export type Config = IConfig < {
917 state : typeof config . state ;
1018 actions : typeof config . actions ;
19+ // effects: typeof config.effects;
1120} > ;
1221
13- import * as actions from "./actions" ;
14-
15- import { createHooks } from "overmind-vue/vue3" ;
16- import state from "./state" ;
22+ export type OnInitialize = IOnInitialize < Config > ;
1723
1824export type Context = IContext < Config > ;
1925
20- export const useOvermind = createHooks ( ) ;
26+ // Used with derived
27+ export type RootState = Context [ "state" ] ;
28+
29+ export const useOvermind = createHooks < Config > ( ) ;
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ type State = {
22 counter : number ;
33} ;
44
5- const state : State = {
5+ export const state : State = {
66 counter : 0 ,
77} ;
8-
9- export default state ;
You can’t perform that action at this time.
0 commit comments