File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ import {
34
34
fetchCount ,
35
35
} from './counterApp'
36
36
37
- import { expectType } from '../typeTestHelpers'
37
+ import { expectType , expectExactType } from '../typeTestHelpers'
38
38
39
39
function preTypedHooksSetup ( ) {
40
40
// Standard hooks setup
@@ -87,6 +87,20 @@ function testShallowEqual() {
87
87
shallowEqual ( { test : 'test' } , { test : 'test' } )
88
88
shallowEqual ( { test : 'test' } , 'a' )
89
89
const x : boolean = shallowEqual ( 'a' , 'a' )
90
+
91
+ type TestState = { stateProp : string }
92
+
93
+ // Additionally, it should infer its type from arguments and not become `any`
94
+ const selected1 = useSelector (
95
+ ( state : TestState ) => state . stateProp ,
96
+ shallowEqual
97
+ )
98
+ expectExactType < string > ( selected1 )
99
+
100
+ const useAppSelector : TypedUseSelectorHook < TestState > = useSelector
101
+
102
+ const selected2 = useAppSelector ( ( state ) => state . stateProp , shallowEqual )
103
+ expectExactType < string > ( selected2 )
90
104
}
91
105
92
106
function testUseDispatch ( ) {
You can’t perform that action at this time.
0 commit comments