Skip to content

Commit 6b3c2b5

Browse files
docs(website): fix operator api docs
1 parent 1e479e5 commit 6b3c2b5

File tree

9 files changed

+26
-27
lines changed

9 files changed

+26
-27
lines changed

packages/overmind-website/examples/api/operators.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ export default (ts) =>
33
? [
44
{
55
code: `
6-
import { action } from 'overmind'
6+
import { Operator, action } from 'overmind'
77
8-
export const changeFoo = action(({ state }) => {
8+
export const changeFoo: Operator = action(({ state }) => {
99
state.foo = 'bar'
1010
})
1111
`,

packages/overmind-website/examples/api/operators_operator_action.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ export default (ts) =>
33
? [
44
{
55
code: `
6-
import { action } from 'overmind'
6+
import { Operator, action } from 'overmind'
77
8-
export const setUser = action<User>(({ value: user, state }) => {
8+
export const setUser: Operator<User> = action(({ value: user, state }) => {
99
state.user = user
1010
})
1111
`,

packages/overmind-website/examples/api/operators_operator_debounce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default (ts) =>
66
import { Operator, pipe, debounce } from 'overmind'
77
import { performSearch } from './operators'
88
9-
export const search: Operator<string, string> = pipe(
9+
export const search: Operator<string> = pipe(
1010
debounce(200),
1111
performSearch
1212
)

packages/overmind-website/examples/api/operators_operator_filter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ export default (ts) =>
33
? [
44
{
55
code: `
6-
import { filter } from 'overmind'
6+
import { Operator, filter } from 'overmind'
77
8-
export const lengthGreaterThan = (length: number) =>
9-
filter<string>(({ value }) => value.length > length)
8+
export const lengthGreaterThan: (length: number) => Operator<string> =
9+
(length) => filter(({ value }) => value.length > length)
1010
`,
1111
},
1212
]

packages/overmind-website/examples/api/operators_operator_fork.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ export default (ts) =>
77
import { fork, Operator } from 'overmind'
88
import { User } from './state'
99
10-
export const forkUserType = (paths: {
11-
[key: string]: Operator<User, any>
12-
}) => fork<User>(({ value: user }) => user.type, paths)
10+
export const forkUserType: (paths: { [key: string]: Operator<User> }) => Operator<User> =
11+
(paths) => fork(({ value: user }) => user.type, paths)
1312
`,
1413
},
1514
{
@@ -18,7 +17,7 @@ export const forkUserType = (paths: {
1817
import { Operator, pipe } from 'overmind'
1918
import { forkUserType, doThis, doThat } from './operators'
2019
21-
export const getUser: Operator<string> = pipe(
20+
export const getUser: Operator<string, User> = pipe(
2221
getUser,
2322
forkUserType({
2423
admin: doThis,

packages/overmind-website/examples/api/operators_operator_map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ export default (ts) =>
33
? [
44
{
55
code: `
6-
import { map } from 'overmind'
6+
import { Operator, map } from 'overmind'
77
import { User } from './state'
88
9-
export const getEventTargetValue = map<Event, string>(({ value: event }) => event.currentTarget.value)
9+
export const getEventTargetValue: Operator<Event, string> = map(({ value: event }) => event.currentTarget.value)
1010
`,
1111
},
1212
]

packages/overmind-website/examples/api/operators_operator_parallel.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ export default (ts) =>
33
? [
44
{
55
code: `
6-
import { Operator, pipe, mutate } from 'overmind'
6+
import { Operator, pipe, action } from 'overmind'
77
import { Item } from './state'
88
9-
export const loadSomeData: Operator<void, void> = pipe(...)
10-
export const loadSomeMoreData: Operator<void, void> = pipe(...)
11-
export const manageAllData = mutate(...)
9+
export const loadSomeData: Operator = pipe(...)
10+
export const loadSomeMoreData: Operator = pipe(...)
11+
export const manageAllData = action(...)
1212
13-
export const openItem: Operator<void, void> = pipe(
14-
parallel([
13+
export const openItem: Operator = pipe(
14+
parallel(
1515
loadSomeData,
1616
loadSomeMoreData
17-
]),
17+
),
1818
manageAllData
1919
)
2020
`,
@@ -23,17 +23,17 @@ export const openItem: Operator<void, void> = pipe(
2323
: [
2424
{
2525
code: `
26-
import { pipe, mutate } from 'overmind'
26+
import { pipe, action } from 'overmind'
2727
2828
export const loadSomeData = pipe(...)
2929
export const loadSomeMoreData = pipe(...)
30-
export const manageAllData = mutate(...)
30+
export const manageAllData = action(...)
3131
3232
export const openItem = pipe(
33-
parallel([
33+
parallel(
3434
loadSomeData,
3535
loadSomeMoreData
36-
]),
36+
),
3737
manageAllData
3838
)
3939
`,

packages/overmind-website/examples/api/operators_operator_wait.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default (ts) =>
66
import { Operator, pipe, wait } from 'overmind'
77
import { executeSomething } from './operators'
88
9-
export const search: Operator<string, string> = pipe(
9+
export const search: Operator<string> = pipe(
1010
wait(2000),
1111
executeSomething
1212
)

packages/overmind-website/src/overmind/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Action, Operator, debounce, pipe, map } from 'overmind'
1+
import { Action, Operator, debounce, pipe, map, action } from 'overmind'
22
import { Page, RouteContext, GuideParams, VideoParams } from './types'
33
import * as o from './operators'
44

0 commit comments

Comments
 (0)