Skip to content

Commit c4a694d

Browse files
committed
fix overmind configuration
1 parent d38e3fc commit c4a694d

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/overmind/index.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
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

37
export 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
815
export 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

1823
export 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>();

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: "Vue 3 + TypeScript + Overmind (the best UI state lib)",
88
counter: 0,
99
};
10-
11-
export default state;

0 commit comments

Comments
 (0)