File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 1- import { IConfig , IContext } from "overmind" ;
1+ import { IConfig , IOnInitialize , IContext } from "overmind" ;
2+ import { createHooks } from "overmind-vue/vue3" ;
3+
4+ import { state } from "./state" ;
5+ import * as actions from "./actions" ;
26
37export const config = {
48 state,
59 actions,
610} ;
711
12+ // Due to circular typing we have to define an
13+ // explicit typing of state, actions and effects since
14+ // TS 3.9
815export type Config = IConfig < {
916 state : typeof config . state ;
1017 actions : typeof config . actions ;
18+ // effects: typeof config.effects;
1119} > ;
1220
13- import * as actions from "./actions" ;
14-
15- import { createHooks } from "overmind-vue/vue3" ;
16- import state from "./state" ;
21+ export type OnInitialize = IOnInitialize < Config > ;
1722
1823export type Context = IContext < Config > ;
1924
20- export const useOvermind = createHooks ( ) ;
25+ // Used with derived
26+ export type RootState = Context [ "state" ] ;
27+
28+ export const useOvermind = createHooks < Config > ( ) ;
Original file line number Diff line number Diff line change @@ -3,9 +3,7 @@ type State = {
33 counter : number ;
44} ;
55
6- const state : State = {
6+ export const state : State = {
77 welcome : "Vue 3 + TypeScript + Overmind (the best UI state lib)" ,
88 counter : 0 ,
99} ;
10-
11- export default state ;
You can’t perform that action at this time.
0 commit comments