File tree Expand file tree Collapse file tree 4 files changed +16
-10
lines changed
Expand file tree Collapse file tree 4 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import { boot } from 'quasar/wrappers';
22import { config } from '../overmind' ;
33import { createOvermind } from 'overmind' ;
44
5- // "async" is optional;
65// more info on params: https://quasar.dev/quasar-cli/boot-files
76export default boot ( ( { app } ) => {
87 const overmind = createOvermind ( config ) ;
Original file line number Diff line number Diff line change 1- import { Context } from '../ overmind' ;
1+ import { Context } from 'overmind' ;
22
33export const inc = ( { state } : Context ) : void => {
44 state . counter += 1 ;
Original file line number Diff line number Diff line change 1- import { IConfig , IContext } from 'overmind' ;
2- import * as actions from './actions' ;
3-
1+ import { IConfig , IOnInitialize , IContext } from 'overmind' ;
42import { createHooks } from 'overmind-vue/vue3' ;
5- import state from './state' ;
3+
4+ import { state } from './state' ;
5+ import * as actions from './actions' ;
66
77export const config = {
88 state,
99 actions,
1010} ;
1111
12+ // Due to circular typing we have to define an
13+ // explicit typing of state, actions and effects since
14+ // TS 3.9
1215export type Config = IConfig < {
1316 state : typeof config . state ;
1417 actions : typeof config . actions ;
18+ // effects: typeof config.effects;
1519} > ;
1620
21+ export type OnInitialize = IOnInitialize < Config > ;
22+
1723export type Context = IContext < Config > ;
1824
19- 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 : 'Quasar 2 + TypeScript + Overmind' ,
88 counter : 0 ,
99} ;
10-
11- export default state ;
You can’t perform that action at this time.
0 commit comments