We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b630f8 commit bd34f1eCopy full SHA for bd34f1e
core/typescript.md
@@ -170,6 +170,30 @@ export const state: State = {
170
{% endtab %}
171
{% endtabs %}
172
173
+Note that the type argument you pass is the object the derived is attached to, so with nested derived:
174
+
175
+{% tabs %}
176
+{% tab title="overmind/state.ts" %}
177
+```typescript
178
+import { derived } from 'overmind'
179
180
+type State = {
181
+ foo: string
182
+ nested: {
183
+ shoutedFoo string
184
+ }
185
+}
186
187
+export const state: State = {
188
+ foo: 'bar',
189
190
+ shoutedFoo: derived<State['nested']>(state => state.foo + '!!!')
191
192
193
+```
194
+{% endtab %}
195
+{% endtabs %}
196
197
## Actions
198
199
The action type takes either an input type, an output type, or both.
0 commit comments