@@ -35,7 +35,7 @@ const fetchUserById = createAsyncThunk(
3535 async (userId : number , thunkAPI ) => {
3636 const response = await userAPI .fetchById (userId )
3737 return response .data
38- }
38+ },
3939)
4040
4141interface UsersState {
@@ -190,23 +190,23 @@ interface RejectedWithValueAction<ThunkArg, RejectedValue> {
190190
191191type Pending = <ThunkArg >(
192192 requestId : string ,
193- arg : ThunkArg
193+ arg : ThunkArg ,
194194) => PendingAction <ThunkArg >
195195
196196type Fulfilled = <ThunkArg , PromiseResult >(
197197 payload : PromiseResult ,
198198 requestId : string ,
199- arg : ThunkArg
199+ arg : ThunkArg ,
200200) => FulfilledAction <ThunkArg , PromiseResult >
201201
202202type Rejected = <ThunkArg >(
203203 requestId : string ,
204- arg : ThunkArg
204+ arg : ThunkArg ,
205205) => RejectedAction <ThunkArg >
206206
207207type RejectedWithValue = <ThunkArg , RejectedValue >(
208208 requestId : string ,
209- arg : ThunkArg
209+ arg : ThunkArg ,
210210) => RejectedWithValueAction <ThunkArg , RejectedValue >
211211` ` `
212212
@@ -365,7 +365,7 @@ const updateUser = createAsyncThunk(
365365 // by explicitly returning it using the `rejectWithValue()` utility
366366 return rejectWithValue (err .response .data )
367367 }
368- }
368+ },
369369)
370370```
371371
@@ -391,7 +391,7 @@ const fetchUserById = createAsyncThunk(
391391 return false
392392 }
393393 },
394- }
394+ },
395395)
396396```
397397
@@ -419,7 +419,7 @@ export const fetchUserById = createAsyncThunk(
419419 ' fetchUserById' ,
420420 (userId : string ) => {
421421 /* ... */
422- }
422+ },
423423)
424424
425425// file: MyComponent.ts
@@ -456,7 +456,7 @@ const fetchUserById = createAsyncThunk(
456456 signal: thunkAPI .signal ,
457457 })
458458 return await response .json ()
459- }
459+ },
460460)
461461```
462462
@@ -486,7 +486,7 @@ const readStream = createAsyncThunk(
486486 done = read .done
487487 }
488488 return result
489- }
489+ },
490490)
491491```
492492
@@ -510,7 +510,7 @@ const fetchUserById = createAsyncThunk(
510510 cancelToken: source .token ,
511511 })
512512 return response .data
513- }
513+ },
514514)
515515```
516516
@@ -527,7 +527,7 @@ If a thunk was cancelled, the result of the promise will be a `rejected` action
527527So if you wanted to test that a thunk was cancelled before executing, you can do the following:
528528
529529``` ts no-transpile
530- import { createAsyncThunk , isRejected } from ' @reduxjs/toolkit'
530+ import { createAsyncThunk } from ' @reduxjs/toolkit'
531531
532532test (' this thunk should always be skipped' , async () => {
533533 const thunk = createAsyncThunk (
@@ -749,7 +749,7 @@ const UsersComponent = (props: { id: string }) => {
749749 // This is an example of an onSubmit handler using Formik meant to demonstrate accessing the payload of the rejected action
750750 const handleUpdateUser = async (
751751 values : FormValues ,
752- formikHelpers : FormikHelpers <FormValues >
752+ formikHelpers : FormikHelpers <FormValues >,
753753 ) => {
754754 const resultAction = await dispatch (updateUser ({ id: props .id , ... values }))
755755 if (updateUser .fulfilled .match (resultAction )) {
0 commit comments