Skip to content

Commit 6fd1e63

Browse files
fix(overmind): fix typing of operators
1 parent 4b188f3 commit 6fd1e63

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

packages/node_modules/overmind/src/internalTypes.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,23 +166,15 @@ type TActionValue<T> = T extends (a1: any, a2: infer TValue) => any
166166
? TValue
167167
: never
168168

169-
type TOperationValue<T> = T extends (
170-
arg1: any,
171-
arg2: infer IContext,
172-
arg3: any
173-
) => any
174-
? (IContext extends { value: infer TValue } ? TValue : never)
175-
: never
176-
177169
export type ResolveActions<
178170
Actions extends NestedActions
179171
> = Actions extends undefined
180172
? {}
181173
: {
182174
[T in keyof Actions]: Actions[T] extends IOperator<any, any, any>
183-
? TOperationValue<Actions[T]> extends void
175+
? TActionValue<Actions[T]> extends void
184176
? () => Promise<void>
185-
: (value: TOperationValue<Actions[T]>) => Promise<void>
177+
: (value: TActionValue<Actions[T]>) => Promise<void>
186178
: Actions[T] extends IAction<any, any, any>
187179
? TActionValue<Actions[T]> extends void
188180
? () => ReturnType<Actions[T]>
@@ -209,9 +201,9 @@ export type ResolveMockActions<
209201
? {}
210202
: {
211203
[T in keyof Actions]: Actions[T] extends IOperator<any, any, any>
212-
? TOperationValue<Actions[T]> extends void
204+
? TActionValue<Actions[T]> extends void
213205
? () => Promise<MockResult>
214-
: (value: TOperationValue<Actions[T]>) => Promise<MockResult>
206+
: (value: TActionValue<Actions[T]>) => Promise<MockResult>
215207
: Actions[T] extends IAction<any, any, any>
216208
? TActionValue<Actions[T]> extends void
217209
? () => Promise<MockResult>

packages/overmind-website/guides/beginner/01_getstarted.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ h(Example, { name: "guide/getstarted/install" })
1919
h(TypescriptNotice, null, "Overmind requires Typescript version **3.2** or above")
2020
```
2121

22-
23-
2422
Great, we are good to go!
2523

2624
## Our first state
2725

28-
Applications are about state and we are going to introduce our first state, **count**. Typically you would be tempted to isolate this state in your component, but this is exactly what Overmind discourages. In Overmind you primarily define the state of your application outside of your view layer. This gives you several benefits which will become clear as we move on.
26+
Applications are about state and we are going to introduce our first state, **count**. But we are not going to introduce this state through a component. We are going to take on the perspective of [UI as an implementation detail](). That means
2927

3028
Let us imagine we get what we need from Overmind in a component:
3129

0 commit comments

Comments
 (0)