Skip to content

Commit 641260e

Browse files
christianalfonigitbook-bot
authored andcommitted
GitBook: [v26] one page modified
1 parent 77c454a commit 641260e

File tree

1 file changed

+6
-30
lines changed

1 file changed

+6
-30
lines changed

core/typescript.md

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ Now you can import any type directly from Overmind and it will understand the co
3636

3737
```typescript
3838
import {
39-
Action,
40-
Operator,
41-
Derive,
39+
Context,
40+
RootState,
4241
pipe,
4342
map,
4443
filter,
@@ -56,9 +55,7 @@ You can also explicitly type your application. This gives more flexibility.
5655
import {
5756
IConfig,
5857
IOnInitialize,
59-
IAction,
60-
IOperator,
61-
IState
58+
IContext,
6259
} from 'overmind'
6360

6461
export const config = {}
@@ -74,11 +71,10 @@ export interface Config extends IConfig<{
7471

7572
export interface OnInitialize extends IOnInitialize<Config> {}
7673

77-
export interface Action<Input = void, Output = void> extends IAction<Config, Input, Output> {}
74+
export interface Context extends IContext<Config> {}
7875

79-
export interface AsyncAction<Input = void, Output = void> extends IAction<Config, Input, Promise<Output>> {}
80-
81-
export interface Operator<Input = void, Output = Input> extends IOperator<Config, Input, Output> {}
76+
// Used with derived
77+
export type RootState = Context['state']
8278
```
8379
{% endtab %}
8480
{% endtabs %}
@@ -141,26 +137,6 @@ export const state: State = {
141137
}
142138
```
143139

144-
### Getter
145-
146-
{% tabs %}
147-
{% tab title="overmind/state.ts" %}
148-
```typescript
149-
type State = {
150-
foo: string
151-
shoutedFoo: string
152-
}
153-
154-
export const state: State = {
155-
foo: 'bar',
156-
get shoutedFoo() {
157-
return this.foo + '!!!'
158-
}
159-
}
160-
```
161-
{% endtab %}
162-
{% endtabs %}
163-
164140
### Derived
165141

166142
{% tabs %}

0 commit comments

Comments
 (0)