Skip to content

Commit c61a299

Browse files
committed
fix types
1 parent 40e0161 commit c61a299

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

src/boot/overmind.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { boot } from 'quasar/wrappers';
22
import { config } from '../overmind';
33
import { createOvermind } from 'overmind';
44

5-
// "async" is optional;
65
// more info on params: https://quasar.dev/quasar-cli/boot-files
76
export default boot(({ app }) => {
87
const overmind = createOvermind(config);

src/overmind/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Context } from '../overmind';
1+
import { Context } from 'overmind';
22

33
export const inc = ({ state }: Context): void => {
44
state.counter += 1;

src/overmind/index.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1-
import { IConfig, IContext } from 'overmind';
2-
import * as actions from './actions';
3-
1+
import { IConfig, IOnInitialize, IContext } from 'overmind';
42
import { createHooks } from 'overmind-vue/vue3';
5-
import state from './state';
3+
4+
import { state } from './state';
5+
import * as actions from './actions';
66

77
export 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
1215
export 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+
1723
export 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>();

src/overmind/state.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)