You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: views/vue.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,6 +142,32 @@ If you prefer using JSX, that is also possible:
142
142
{% endtab %}
143
143
{% endtabs %}
144
144
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*asactionsfrom'./actions'
155
+
156
+
exportconst config = {
157
+
state,
158
+
actions
159
+
}
160
+
161
+
exporttypeContext=IContext<{
162
+
state:typeofconfig.state
163
+
actions:typeofconfig.actions
164
+
}>
165
+
166
+
exportconst hooks =createHooks<Context>()
167
+
```
168
+
{% endtab %}
169
+
{% endtabs %}
170
+
145
171
## Plugin
146
172
147
173
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