Skip to content

Commit 320da18

Browse files
christianalfonigitbook-bot
authored andcommitted
GitBook: [v28] one page modified
1 parent 29f0952 commit 320da18

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

views/vue.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,32 @@ If you prefer using JSX, that is also possible:
142142
{% endtab %}
143143
{% endtabs %}
144144

145+
With **TypeScript** you type them by:
146+
147+
{% tabs %}
148+
{% tab title="Typescript" %}
149+
```typescript
150+
// overmind/index.ts
151+
import { IContext } from 'overmind'
152+
import {createHooks } from 'overmind-vue/vu3'
153+
import { state } from './state'
154+
import * as actions from './actions'
155+
156+
export const config = {
157+
state,
158+
actions
159+
}
160+
161+
export type Context = IContext<{
162+
state: typeof config.state
163+
actions: typeof config.actions
164+
}>
165+
166+
export const hooks = createHooks<Context>()
167+
```
168+
{% endtab %}
169+
{% endtabs %}
170+
145171
## Plugin
146172

147173
Vue has a plugin system that allows us to expose Overmind to all components. This allows minimum configuration and you just use state etc. from any component.

0 commit comments

Comments
 (0)