@@ -603,6 +603,7 @@ const anyAction = { type: 'foo' } as AnyAction
603
603
state : RootState
604
604
dispatch : AppDispatch
605
605
rejectValue : string
606
+ extra : { s : string ; n : number }
606
607
} > ( )
607
608
608
609
// inferred usage
@@ -618,6 +619,11 @@ const anyAction = { type: 'foo' } as AnyAction
618
619
return getState ( ) . foo . value
619
620
} )
620
621
622
+ // correct extra type
623
+ const { s, n } = api . extra
624
+ expectExactType < string > ( s )
625
+ expectExactType < number > ( n )
626
+
621
627
if ( 1 < 2 )
622
628
// @ts -expect-error
623
629
return api . rejectWithValue ( 5 )
@@ -638,6 +644,11 @@ const anyAction = { type: 'foo' } as AnyAction
638
644
expectExactType < ( ) => { foo : { value : number } } > ( ANY ) ( getState )
639
645
return getState ( ) . foo . value
640
646
} )
647
+ // correct extra type
648
+ const { s, n } = api . extra
649
+ expectExactType < string > ( s )
650
+ expectExactType < number > ( n )
651
+
641
652
if ( 1 < 2 )
642
653
// @ts -expect-error
643
654
return api . rejectWithValue ( 5 )
@@ -660,6 +671,10 @@ const anyAction = { type: 'foo' } as AnyAction
660
671
expectExactType < ( ) => { foo : { value : number } } > ( ANY ) ( getState )
661
672
return getState ( ) . foo . value
662
673
} )
674
+ // correct extra type
675
+ const { s, n } = api . extra
676
+ expectExactType < string > ( s )
677
+ expectExactType < number > ( n )
663
678
if ( 1 < 2 ) return api . rejectWithValue ( 5 )
664
679
if ( 1 < 2 )
665
680
// @ts -expect-error
0 commit comments