@@ -72,7 +72,7 @@ describe('useQuery', () => {
7272 // it should provide the result type in the configuration
7373 useQuery ( ( ) => ( {
7474 queryKey : [ key ] ,
75- queryFn : async ( ) => true ,
75+ queryFn : ( ) => true ,
7676 } ) )
7777
7878 // it should be possible to specify a union type as result type
@@ -117,7 +117,7 @@ describe('useQuery', () => {
117117 type MyData = number
118118 type MyQueryKey = readonly [ 'my-data' , number ]
119119
120- const getMyDataArrayKey : QueryFunction < MyData , MyQueryKey > = async ( {
120+ const getMyDataArrayKey : QueryFunction < MyData , MyQueryKey > = ( {
121121 queryKey : [ , n ] ,
122122 } ) => {
123123 return n + 42
@@ -128,9 +128,7 @@ describe('useQuery', () => {
128128 queryFn : getMyDataArrayKey ,
129129 } ) )
130130
131- const getMyDataStringKey : QueryFunction < MyData , [ '1' ] > = async (
132- context ,
133- ) => {
131+ const getMyDataStringKey : QueryFunction < MyData , [ '1' ] > = ( context ) => {
134132 expectTypeOf ( context . queryKey ) . toEqualTypeOf < [ '1' ] > ( )
135133 return Number ( context . queryKey [ 0 ] ) + 42
136134 }
@@ -170,7 +168,7 @@ describe('useQuery', () => {
170168 queryFn : ( ) => fetcher ( qk [ 1 ] , 'token' ) ,
171169 ...options ,
172170 } ) )
173- const test = useWrappedQuery ( [ '' ] , async ( ) => '1' )
171+ const test = useWrappedQuery ( [ '' ] , ( ) => Promise . resolve ( '1' ) )
174172 expectTypeOf ( test . data ) . toEqualTypeOf < string | undefined > ( )
175173
176174 // handles wrapped queries with custom fetcher passed directly to useQuery
@@ -188,7 +186,9 @@ describe('useQuery', () => {
188186 'safely'
189187 > ,
190188 ) => useQuery ( ( ) => ( { queryKey : qk , queryFn : fetcher , ...options } ) )
191- const testFuncStyle = useWrappedFuncStyleQuery ( [ '' ] , async ( ) => true )
189+ const testFuncStyle = useWrappedFuncStyleQuery ( [ '' ] , ( ) =>
190+ Promise . resolve ( true ) ,
191+ )
192192 expectTypeOf ( testFuncStyle . data ) . toEqualTypeOf < boolean | undefined > ( )
193193 }
194194 } )
@@ -1854,7 +1854,7 @@ describe('useQuery', () => {
18541854 } )
18551855
18561856 // See https://github.com/tannerlinsley/react-query/issues/137
1857- it ( 'should not override initial data in dependent queries' , async ( ) => {
1857+ it ( 'should not override initial data in dependent queries' , ( ) => {
18581858 const key1 = queryKey ( )
18591859 const key2 = queryKey ( )
18601860
@@ -1895,7 +1895,7 @@ describe('useQuery', () => {
18951895 rendered . getByText ( 'Second Status: success' )
18961896 } )
18971897
1898- it ( 'should update query options' , async ( ) => {
1898+ it ( 'should update query options' , ( ) => {
18991899 const key = queryKey ( )
19001900
19011901 const queryFn = async ( ) => {
@@ -2018,7 +2018,7 @@ describe('useQuery', () => {
20182018 } )
20192019
20202020 // See https://github.com/tannerlinsley/react-query/issues/144
2021- it ( 'should be in "pending" state by default' , async ( ) => {
2021+ it ( 'should be in "pending" state by default' , ( ) => {
20222022 const key = queryKey ( )
20232023
20242024 function Page ( ) {
@@ -3403,7 +3403,7 @@ describe('useQuery', () => {
34033403
34043404 const query = useQuery < unknown , Error > ( ( ) => ( {
34053405 queryKey : key ,
3406- queryFn : async ( ) => {
3406+ queryFn : ( ) => {
34073407 if ( counter < 2 ) {
34083408 counter ++
34093409 throw new Error ( 'error' )
@@ -3753,7 +3753,7 @@ describe('useQuery', () => {
37533753 expect ( results [ 2 ] ) . toMatchObject ( { data : 'fetched data' , isStale : false } )
37543754 } )
37553755
3756- it ( 'should support enabled:false in query object syntax' , async ( ) => {
3756+ it ( 'should support enabled:false in query object syntax' , ( ) => {
37573757 const key = queryKey ( )
37583758 const queryFn = vi . fn < ( ...args : Array < unknown > ) => string > ( )
37593759 queryFn . mockImplementation ( ( ) => 'data' )
@@ -5916,7 +5916,7 @@ describe('useQuery', () => {
59165916 const states : Array < UseQueryResult < unknown > > = [ ]
59175917 const error = new Error ( 'oops' )
59185918
5919- const queryFn = async ( ) : Promise < unknown > => {
5919+ const queryFn = ( ) : Promise < unknown > => {
59205920 throw error
59215921 }
59225922
@@ -5996,7 +5996,7 @@ describe('useQuery', () => {
59965996 function Page ( ) {
59975997 const state = useQuery ( ( ) => ( {
59985998 queryKey : key ,
5999- queryFn : async ( ) : Promise < unknown > => {
5999+ queryFn : ( ) : Promise < unknown > => {
60006000 throw error
60016001 } ,
60026002 retry : false ,
0 commit comments