Skip to content

Commit 98e6f55

Browse files
docs(website): fix typing for explicit overmind typing
1 parent 215562c commit 98e6f55

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
TReaction,
2020
TValueContext,
2121
TOnInitialize,
22-
StateObject,
22+
TStateObject,
2323
} from './types'
2424

2525
export * from './types'
@@ -34,7 +34,7 @@ type TheConfig = IConfig & TConfig<{ actions: {} }>
3434

3535
export type Action<Value = void> = TAction<TheConfig, Value>
3636

37-
export type Derive<Parent extends StateObject, Value> = TDerive<
37+
export type Derive<Parent extends TStateObject, Value> = TDerive<
3838
TheConfig,
3939
Parent,
4040
Value

packages/node_modules/overmind/src/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ export type BaseApp = {
1818
actions: {}
1919
}
2020

21-
export type StateObject =
21+
export type TStateObject =
2222
| {
2323
[key: string]:
24-
| StateObject
24+
| TStateObject
2525
| string
2626
| TDerive<any, any, any>
2727
| number
@@ -68,7 +68,7 @@ export type TOperator<Config extends Configuration, Input, Output> = (
6868

6969
export type TDerive<
7070
Config extends Configuration,
71-
Parent extends StateObject,
71+
Parent extends TStateObject,
7272
Value
7373
> = (
7474
parent: ResolveState<Parent>,

packages/overmind-website/examples/guide/typescript/explicit.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,24 @@ import {
77
TAction,
88
TOperator,
99
TDerive,
10-
TReaction
10+
TStateObject
1111
} from 'overmind'
1212
1313
const config = {}
1414
15-
export type Config = TConfig<typeof config>
15+
export type Config = TConfig<{
16+
state: typeof config["state"]
17+
actions: typeof config["actions"]
18+
effects: typeof config["effects"]
19+
}>
1620
1721
export type OnInitialize = TOnInitialize<Config>
1822
19-
export type Action<Input> = TAction<Config, Input>
23+
export type Action<Input = void> = TAction<Config, Input>
2024
2125
export type Operator<Input, Output> = TOperator<Config, Input, Output>
2226
23-
export type Derive<Parent extends object, Output> = TDerive<Config, Parent, Output>
24-
25-
export type Reaction = TReaction<Config>
27+
export type Derive<Parent extends TStateObject, Output> = TDerive<Config, Parent, Output>
2628
`,
2729
},
2830
]

0 commit comments

Comments
 (0)