@@ -31,17 +31,17 @@ describe('type tests', () => {
3131 foo => foo
3232 )
3333
34- const res = selector . resultFunc ( 'test' )
35- selector . recomputations ( )
36- selector . resetRecomputations ( )
34+ expectTypeOf ( selector . resultFunc ) . toBeCallableWith ( 'test' )
3735
38- const foo : string = selector ( { foo : 'bar' } )
36+ expectTypeOf ( selector . recomputations ) . toBeFunction ( )
3937
40- // @ts -expect-error
41- selector ( { foo : 'bar' } , { prop : 'value' } )
38+ expectTypeOf ( selector . resetRecomputations ) . toBeFunction ( )
4239
43- // @ts -expect-error
44- const num : number = selector ( { foo : 'bar' } )
40+ expectTypeOf ( selector ( { foo : 'bar' } ) ) . toBeString ( )
41+
42+ expectTypeOf ( selector ) . parameters . not . toHaveProperty ( '1' )
43+
44+ expectTypeOf ( selector ( { foo : 'bar' } ) ) . not . toBeNumber ( )
4545
4646 // allows heterogeneous parameter type input selectors
4747 createSelector (
@@ -73,13 +73,11 @@ describe('type tests', () => {
7373
7474 const selector = createSelector ( ( state : State ) => state . bar , subSelector )
7575
76- // @ts -expect-error
77- selector ( { foo : '' } )
76+ expectTypeOf ( selector ) . parameter ( 0 ) . not . toMatchTypeOf ( { foo : '' } )
7877
79- // @ts -expect-error
80- const n : number = selector ( { bar : { foo : '' } } )
78+ expectTypeOf ( selector ( { bar : { foo : '' } } ) ) . not . toBeNumber ( )
8179
82- const s : string = selector ( { bar : { foo : '' } } )
80+ expectTypeOf ( selector ( { bar : { foo : '' } } ) ) . toBeString ( )
8381 } )
8482
8583 test ( 'connect' , ( ) => {
@@ -89,10 +87,9 @@ describe('type tests', () => {
8987 foo => ( { foo } )
9088 )
9189 ) ( props => {
92- // @ts -expect-error
93- props . bar
90+ expectTypeOf ( props ) . not . toHaveProperty ( 'bar' )
9491
95- const foo : string = props . foo
92+ expectTypeOf ( props ) . toHaveProperty ( ' foo' ) . toBeString ( )
9693 } )
9794
9895 const selector2 = createSelector (
@@ -102,17 +99,20 @@ describe('type tests', () => {
10299 )
103100
104101 const connected = connect ( selector2 ) ( props => {
105- const foo : string = props . foo
106- const bar : number = props . bar
107- const baz : number = props . baz
108- // @ts -expect-error
109- props . fizz
102+ expectTypeOf ( props ) . toHaveProperty ( 'foo' ) . toBeString ( )
103+
104+ expectTypeOf ( props ) . toHaveProperty ( 'bar' ) . toBeNumber ( )
105+
106+ expectTypeOf ( props ) . toHaveProperty ( 'baz' ) . toBeNumber ( )
107+
108+ expectTypeOf ( props ) . not . toHaveProperty ( 'fizz' )
110109 } )
111110
112- connected ( { bar : 42 } )
111+ expectTypeOf ( connected ) . toBeCallableWith ( { bar : 42 } )
113112
114- // @ts -expect-error
115- connected ( { bar : 42 , baz : 123 } )
113+ expectTypeOf ( connected )
114+ . parameter ( 0 )
115+ . not . toMatchTypeOf ( { bar : 42 , baz : 123 } )
116116 } )
117117
118118 test ( 'invalid type in combiner' , ( ) => {
@@ -224,7 +224,7 @@ describe('type tests', () => {
224224 }
225225 )
226226
227- const res1 = selector1 ( {
227+ expectTypeOf ( selector1 ) . toBeCallableWith ( {
228228 testString : 'a' ,
229229 testNumber : 42 ,
230230 testBoolean : true ,
0 commit comments