Skip to content

Commit fb0d989

Browse files
docs(type): update old usage of NextModel (#127)
1 parent 67ffffc commit fb0d989

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,16 @@ TypeScript Example
322322
// StateType and ActionsParamType definition
323323
// ...
324324

325-
const model: NextModelType<StateType, ActionsParamType> = {
325+
const model: ModelType<StateType, ActionsParamType> = {
326326
actions: {
327-
increment: async (s, _, params) => {
327+
increment: async (params, { state: s }) => {
328328
// issue: https://github.com/Microsoft/TypeScript/issues/29196
329329
// async function return produce need define type manually.
330330
return (state: typeof s) => {
331331
state.counter += params || 1
332332
}
333333
},
334-
decrease: (s, _, params) => s => {
334+
decrease: params => s => {
335335
s.counter += params || 1
336336
}
337337
}
@@ -345,7 +345,7 @@ JavaScript Example
345345
```js
346346
const Model = {
347347
actions: {
348-
increment: async (s, _, params) => {
348+
increment: async (params) => {
349349
return state => {
350350
state.counter += params || 1
351351
}
@@ -367,7 +367,7 @@ const initialState = {
367367
counter: 0
368368
}
369369

370-
const model: NextModelType<StateType, ActionsParamType> = {
370+
const model: ModelType<StateType, ActionsParamType> = {
371371
actions: {
372372
increment: (params, { state }) => {
373373
return {
@@ -752,7 +752,7 @@ interface ActionParams {
752752
increment: number
753753
}
754754

755-
const model: NextModelType<State, ActionParams> = {
755+
const model: ModelType<State, ActionParams> = {
756756
state: {
757757
count: 0
758758
},

0 commit comments

Comments
 (0)