@@ -652,6 +652,38 @@ describe('type tests', () => {
652
652
expectTypeOf ( action . error ) . toEqualTypeOf < 'error' > ( )
653
653
} ,
654
654
) ,
655
+ testInferVoid : create . asyncThunk ( ( ) => { } , {
656
+ pending ( state , action ) {
657
+ expectTypeOf ( state ) . toEqualTypeOf < TestState > ( )
658
+
659
+ expectTypeOf ( action . meta . arg ) . toBeVoid ( )
660
+ } ,
661
+ fulfilled ( state , action ) {
662
+ expectTypeOf ( state ) . toEqualTypeOf < TestState > ( )
663
+
664
+ expectTypeOf ( action . meta . arg ) . toBeVoid ( )
665
+
666
+ expectTypeOf ( action . payload ) . toBeVoid ( )
667
+ } ,
668
+ rejected ( state , action ) {
669
+ expectTypeOf ( state ) . toEqualTypeOf < TestState > ( )
670
+
671
+ expectTypeOf ( action . meta . arg ) . toBeVoid ( )
672
+
673
+ expectTypeOf ( action . error ) . toEqualTypeOf < SerializedError > ( )
674
+ } ,
675
+ settled ( state , action ) {
676
+ expectTypeOf ( state ) . toEqualTypeOf < TestState > ( )
677
+
678
+ expectTypeOf ( action . meta . arg ) . toBeVoid ( )
679
+
680
+ if ( isRejected ( action ) ) {
681
+ expectTypeOf ( action . error ) . toEqualTypeOf < SerializedError > ( )
682
+ } else {
683
+ expectTypeOf ( action . payload ) . toBeVoid ( )
684
+ }
685
+ } ,
686
+ } ) ,
655
687
testInfer : create . asyncThunk (
656
688
function payloadCreator ( arg : TestArg , api ) {
657
689
return Promise . resolve < TestReturned > ( { payload : 'foo' } )
@@ -856,6 +888,12 @@ describe('type tests', () => {
856
888
>
857
889
> ( )
858
890
891
+ expectTypeOf ( slice . actions . testInferVoid ) . toEqualTypeOf <
892
+ AsyncThunk < void , void , { } >
893
+ > ( )
894
+
895
+ expectTypeOf ( slice . actions . testInferVoid ) . toBeCallableWith ( )
896
+
859
897
expectTypeOf ( slice . actions . testInfer ) . toEqualTypeOf <
860
898
AsyncThunk < TestReturned , TestArg , { } >
861
899
> ( )
0 commit comments