@@ -481,27 +481,49 @@ const anyAction = { type: 'foo' } as AnyAction
481
481
{
482
482
// return values
483
483
createAsyncThunk < 'ret' , void , { } > ( 'test' , ( _ , api ) => 'ret' as const )
484
+ createAsyncThunk < 'ret' , void , { } > ( 'test' , async ( _ , api ) => 'ret' as const )
484
485
createAsyncThunk < 'ret' , void , { fulfilledMeta : string } > ( 'test' , ( _ , api ) =>
485
486
api . fulfillWithValue ( 'ret' as const , '' )
486
487
)
488
+ createAsyncThunk < 'ret' , void , { fulfilledMeta : string } > (
489
+ 'test' ,
490
+ async ( _ , api ) => api . fulfillWithValue ( 'ret' as const , '' )
491
+ )
487
492
createAsyncThunk < 'ret' , void , { fulfilledMeta : string } > (
488
493
'test' ,
489
494
// @ts -expect-error has to be a fulfilledWithValue call
490
495
( _ , api ) => 'ret' as const
491
496
)
497
+ createAsyncThunk < 'ret' , void , { fulfilledMeta : string } > (
498
+ 'test' ,
499
+ // @ts -expect-error has to be a fulfilledWithValue call
500
+ async ( _ , api ) => 'ret' as const
501
+ )
492
502
createAsyncThunk < 'ret' , void , { fulfilledMeta : string } > (
493
503
'test' , // @ts -expect-error should only allow returning with 'test'
494
504
( _ , api ) => api . fulfillWithValue ( 5 , '' )
495
505
)
506
+ createAsyncThunk < 'ret' , void , { fulfilledMeta : string } > (
507
+ 'test' , // @ts -expect-error should only allow returning with 'test'
508
+ async ( _ , api ) => api . fulfillWithValue ( 5 , '' )
509
+ )
496
510
497
511
// reject values
498
512
createAsyncThunk < 'ret' , void , { rejectValue : string } > ( 'test' , ( _ , api ) =>
499
513
api . rejectWithValue ( 'ret' )
500
514
)
515
+ createAsyncThunk < 'ret' , void , { rejectValue : string } > (
516
+ 'test' ,
517
+ async ( _ , api ) => api . rejectWithValue ( 'ret' )
518
+ )
501
519
createAsyncThunk < 'ret' , void , { rejectValue : string ; rejectedMeta : number } > (
502
520
'test' ,
503
521
( _ , api ) => api . rejectWithValue ( 'ret' , 5 )
504
522
)
523
+ createAsyncThunk < 'ret' , void , { rejectValue : string ; rejectedMeta : number } > (
524
+ 'test' ,
525
+ async ( _ , api ) => api . rejectWithValue ( 'ret' , 5 )
526
+ )
505
527
createAsyncThunk < 'ret' , void , { rejectValue : string ; rejectedMeta : number } > (
506
528
'test' ,
507
529
( _ , api ) => api . rejectWithValue ( 'ret' , 5 )
@@ -511,9 +533,19 @@ const anyAction = { type: 'foo' } as AnyAction
511
533
// @ts -expect-error wrong rejectedMeta type
512
534
( _ , api ) => api . rejectWithValue ( 'ret' , '' )
513
535
)
536
+ createAsyncThunk < 'ret' , void , { rejectValue : string ; rejectedMeta : number } > (
537
+ 'test' ,
538
+ // @ts -expect-error wrong rejectedMeta type
539
+ async ( _ , api ) => api . rejectWithValue ( 'ret' , '' )
540
+ )
514
541
createAsyncThunk < 'ret' , void , { rejectValue : string ; rejectedMeta : number } > (
515
542
'test' ,
516
543
// @ts -expect-error wrong rejectValue type
517
544
( _ , api ) => api . rejectWithValue ( 5 , '' )
518
545
)
546
+ createAsyncThunk < 'ret' , void , { rejectValue : string ; rejectedMeta : number } > (
547
+ 'test' ,
548
+ // @ts -expect-error wrong rejectValue type
549
+ async ( _ , api ) => api . rejectWithValue ( 5 , '' )
550
+ )
519
551
}
0 commit comments