@@ -652,6 +652,38 @@ describe('type tests', () => {
652652 expectTypeOf ( action . error ) . toEqualTypeOf < 'error' > ( )
653653 } ,
654654 ) ,
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+ } ) ,
655687 testInfer : create . asyncThunk (
656688 function payloadCreator ( arg : TestArg , api ) {
657689 return Promise . resolve < TestReturned > ( { payload : 'foo' } )
@@ -856,6 +888,12 @@ describe('type tests', () => {
856888 >
857889 > ( )
858890
891+ expectTypeOf ( slice . actions . testInferVoid ) . toEqualTypeOf <
892+ AsyncThunk < void , void , { } >
893+ > ( )
894+
895+ expectTypeOf ( slice . actions . testInferVoid ) . toBeCallableWith ( )
896+
859897 expectTypeOf ( slice . actions . testInfer ) . toEqualTypeOf <
860898 AsyncThunk < TestReturned , TestArg , { } >
861899 > ( )
0 commit comments