@tanstack/react-query 5.0.0-beta.19 → 5.0.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/build/legacy/useQueries.cjs.map +1 -1
  2. package/build/legacy/useQueries.d.cts +3 -3
  3. package/build/legacy/useQueries.d.ts +3 -3
  4. package/build/legacy/useQueries.js.map +1 -1
  5. package/build/legacy/useSuspenseQueries.cjs.map +1 -1
  6. package/build/legacy/useSuspenseQueries.d.cts +5 -5
  7. package/build/legacy/useSuspenseQueries.d.ts +5 -5
  8. package/build/legacy/useSuspenseQueries.js.map +1 -1
  9. package/build/legacy/utils.cjs.map +1 -1
  10. package/build/legacy/utils.d.cts +1 -1
  11. package/build/legacy/utils.d.ts +1 -1
  12. package/build/legacy/utils.js.map +1 -1
  13. package/build/modern/useQueries.cjs.map +1 -1
  14. package/build/modern/useQueries.d.cts +3 -3
  15. package/build/modern/useQueries.d.ts +3 -3
  16. package/build/modern/useQueries.js.map +1 -1
  17. package/build/modern/useSuspenseQueries.cjs.map +1 -1
  18. package/build/modern/useSuspenseQueries.d.cts +5 -5
  19. package/build/modern/useSuspenseQueries.d.ts +5 -5
  20. package/build/modern/useSuspenseQueries.js.map +1 -1
  21. package/build/modern/utils.cjs.map +1 -1
  22. package/build/modern/utils.d.cts +1 -1
  23. package/build/modern/utils.d.ts +1 -1
  24. package/build/modern/utils.js.map +1 -1
  25. package/package.json +2 -2
  26. package/src/__tests__/suspense.test.tsx +7 -6
  27. package/src/__tests__/useInfiniteQuery.test.tsx +21 -21
  28. package/src/__tests__/useIsFetching.test.tsx +2 -2
  29. package/src/__tests__/useMutation.test.tsx +4 -4
  30. package/src/__tests__/useMutationState.test.tsx +4 -4
  31. package/src/__tests__/useQueries.test.tsx +14 -12
  32. package/src/__tests__/useQuery.test.tsx +80 -80
  33. package/src/useQueries.ts +33 -27
  34. package/src/useSuspenseQueries.ts +33 -27
  35. package/src/utils.ts +1 -1
  36. package/build/codemods/coverage/base.css +0 -224
  37. package/build/codemods/coverage/block-navigation.js +0 -87
  38. package/build/codemods/coverage/clover.xml +0 -6
  39. package/build/codemods/coverage/coverage-final.json +0 -1
  40. package/build/codemods/coverage/favicon.png +0 -0
  41. package/build/codemods/coverage/index.html +0 -101
  42. package/build/codemods/coverage/prettify.css +0 -1
  43. package/build/codemods/coverage/prettify.js +0 -2
  44. package/build/codemods/coverage/sort-arrow-sprite.png +0 -0
  45. package/build/codemods/coverage/sorter.js +0 -196
@@ -206,7 +206,7 @@ describe('useQuery', () => {
206
206
 
207
207
  it('should return the correct states for a successful query', async () => {
208
208
  const key = queryKey()
209
- const states: UseQueryResult<string>[] = []
209
+ const states: Array<UseQueryResult<string>> = []
210
210
 
211
211
  function Page() {
212
212
  const state = useQuery<string, Error>({
@@ -300,7 +300,7 @@ describe('useQuery', () => {
300
300
  it('should return the correct states for an unsuccessful query', async () => {
301
301
  const key = queryKey()
302
302
 
303
- const states: UseQueryResult[] = []
303
+ const states: Array<UseQueryResult> = []
304
304
 
305
305
  function Page() {
306
306
  const state = useQuery({
@@ -549,7 +549,7 @@ describe('useQuery', () => {
549
549
 
550
550
  it('should be able to watch a query without providing a query function', async () => {
551
551
  const key = queryKey()
552
- const states: UseQueryResult<string>[] = []
552
+ const states: Array<UseQueryResult<string>> = []
553
553
 
554
554
  queryClient.setQueryDefaults(key, { queryFn: () => 'data' })
555
555
 
@@ -570,7 +570,7 @@ describe('useQuery', () => {
570
570
 
571
571
  it('should pick up a query when re-mounting with gcTime 0', async () => {
572
572
  const key = queryKey()
573
- const states: UseQueryResult<string>[] = []
573
+ const states: Array<UseQueryResult<string>> = []
574
574
 
575
575
  function Page() {
576
576
  const [toggle, setToggle] = React.useState(false)
@@ -643,7 +643,7 @@ describe('useQuery', () => {
643
643
 
644
644
  it('should not get into an infinite loop when removing a query with gcTime 0 and rerendering', async () => {
645
645
  const key = queryKey()
646
- const states: UseQueryResult<string>[] = []
646
+ const states: Array<UseQueryResult<string>> = []
647
647
 
648
648
  function Page() {
649
649
  const [, rerender] = React.useState({})
@@ -705,7 +705,7 @@ describe('useQuery', () => {
705
705
 
706
706
  it('should fetch when refetchOnMount is false and nothing has been fetched yet', async () => {
707
707
  const key = queryKey()
708
- const states: UseQueryResult<string>[] = []
708
+ const states: Array<UseQueryResult<string>> = []
709
709
 
710
710
  function Page() {
711
711
  const state = useQuery({
@@ -728,7 +728,7 @@ describe('useQuery', () => {
728
728
 
729
729
  it('should not fetch when refetchOnMount is false and data has been fetched already', async () => {
730
730
  const key = queryKey()
731
- const states: UseQueryResult<string>[] = []
731
+ const states: Array<UseQueryResult<string>> = []
732
732
 
733
733
  queryClient.setQueryData(key, 'prefetched')
734
734
 
@@ -752,7 +752,7 @@ describe('useQuery', () => {
752
752
 
753
753
  it('should be able to select a part of the data with select', async () => {
754
754
  const key = queryKey()
755
- const states: UseQueryResult<string>[] = []
755
+ const states: Array<UseQueryResult<string>> = []
756
756
 
757
757
  function Page() {
758
758
  const state = useQuery({
@@ -778,7 +778,7 @@ describe('useQuery', () => {
778
778
 
779
779
  it('should be able to select a part of the data with select in object syntax', async () => {
780
780
  const key = queryKey()
781
- const states: UseQueryResult<string>[] = []
781
+ const states: Array<UseQueryResult<string>> = []
782
782
 
783
783
  function Page() {
784
784
  const state = useQuery({
@@ -804,7 +804,7 @@ describe('useQuery', () => {
804
804
 
805
805
  it('should throw an error when a selector throws', async () => {
806
806
  const key = queryKey()
807
- const states: UseQueryResult<string>[] = []
807
+ const states: Array<UseQueryResult<string>> = []
808
808
  const error = new Error('Select Error')
809
809
 
810
810
  function Page() {
@@ -871,7 +871,7 @@ describe('useQuery', () => {
871
871
 
872
872
  it('should track properties and only re-render when a tracked property changes', async () => {
873
873
  const key = queryKey()
874
- const states: UseQueryResult<string>[] = []
874
+ const states: Array<UseQueryResult<string>> = []
875
875
 
876
876
  function Page() {
877
877
  const state = useQuery({
@@ -913,7 +913,7 @@ describe('useQuery', () => {
913
913
  it('should always re-render if we are tracking props but not using any', async () => {
914
914
  const key = queryKey()
915
915
  let renderCount = 0
916
- const states: UseQueryResult<string>[] = []
916
+ const states: Array<UseQueryResult<string>> = []
917
917
 
918
918
  function Page() {
919
919
  const state = useQuery({ queryKey: key, queryFn: () => 'test' })
@@ -948,7 +948,7 @@ describe('useQuery', () => {
948
948
 
949
949
  it('should be able to remove a query', async () => {
950
950
  const key = queryKey()
951
- const states: UseQueryResult<number>[] = []
951
+ const states: Array<UseQueryResult<number>> = []
952
952
  let count = 0
953
953
 
954
954
  function Page() {
@@ -994,7 +994,7 @@ describe('useQuery', () => {
994
994
 
995
995
  it('should create a new query when refetching a removed query', async () => {
996
996
  const key = queryKey()
997
- const states: UseQueryResult<number>[] = []
997
+ const states: Array<UseQueryResult<number>> = []
998
998
  let count = 0
999
999
 
1000
1000
  function Page() {
@@ -1055,7 +1055,7 @@ describe('useQuery', () => {
1055
1055
  { id: '2', done: true },
1056
1056
  ]
1057
1057
 
1058
- const states: UseQueryResult<typeof result1>[] = []
1058
+ const states: Array<UseQueryResult<typeof result1>> = []
1059
1059
 
1060
1060
  let count = 0
1061
1061
 
@@ -1110,7 +1110,7 @@ describe('useQuery', () => {
1110
1110
 
1111
1111
  it('should use query function from hook when the existing query does not have a query function', async () => {
1112
1112
  const key = queryKey()
1113
- const results: DefinedUseQueryResult<string>[] = []
1113
+ const results: Array<DefinedUseQueryResult<string>> = []
1114
1114
 
1115
1115
  queryClient.setQueryData(key, 'set')
1116
1116
 
@@ -1154,7 +1154,7 @@ describe('useQuery', () => {
1154
1154
 
1155
1155
  it('should update query stale state and refetch when invalidated with invalidateQueries', async () => {
1156
1156
  const key = queryKey()
1157
- const states: UseQueryResult<number>[] = []
1157
+ const states: Array<UseQueryResult<number>> = []
1158
1158
  let count = 0
1159
1159
 
1160
1160
  function Page() {
@@ -1223,7 +1223,7 @@ describe('useQuery', () => {
1223
1223
 
1224
1224
  it('should not update disabled query when refetched with refetchQueries', async () => {
1225
1225
  const key = queryKey()
1226
- const states: UseQueryResult<number>[] = []
1226
+ const states: Array<UseQueryResult<number>> = []
1227
1227
  let count = 0
1228
1228
 
1229
1229
  function Page() {
@@ -1263,7 +1263,7 @@ describe('useQuery', () => {
1263
1263
 
1264
1264
  it('should not refetch disabled query when invalidated with invalidateQueries', async () => {
1265
1265
  const key = queryKey()
1266
- const states: UseQueryResult<number>[] = []
1266
+ const states: Array<UseQueryResult<number>> = []
1267
1267
  let count = 0
1268
1268
 
1269
1269
  function Page() {
@@ -1303,7 +1303,7 @@ describe('useQuery', () => {
1303
1303
 
1304
1304
  it('should not fetch when switching to a disabled query', async () => {
1305
1305
  const key = queryKey()
1306
- const states: UseQueryResult<number>[] = []
1306
+ const states: Array<UseQueryResult<number>> = []
1307
1307
 
1308
1308
  function Page() {
1309
1309
  const [count, setCount] = React.useState(0)
@@ -1366,7 +1366,7 @@ describe('useQuery', () => {
1366
1366
 
1367
1367
  it('should keep the previous data when placeholderData is set', async () => {
1368
1368
  const key = queryKey()
1369
- const states: UseQueryResult<number>[] = []
1369
+ const states: Array<UseQueryResult<number>> = []
1370
1370
 
1371
1371
  function Page() {
1372
1372
  const [count, setCount] = React.useState(0)
@@ -1430,7 +1430,7 @@ describe('useQuery', () => {
1430
1430
 
1431
1431
  it('should keep the previous data when placeholderData is set and select fn transform is used', async () => {
1432
1432
  const key = queryKey()
1433
- const states: UseQueryResult<number>[] = []
1433
+ const states: Array<UseQueryResult<number>> = []
1434
1434
 
1435
1435
  function Page() {
1436
1436
  const [count, setCount] = React.useState(0)
@@ -1498,9 +1498,9 @@ describe('useQuery', () => {
1498
1498
  })
1499
1499
 
1500
1500
  it('should keep the previous queryKey (from prevQuery) between multiple pending queries when placeholderData is set and select fn transform is used', async () => {
1501
- const keys: Array<readonly unknown[] | null> = []
1501
+ const keys: Array<ReadonlyArray<unknown> | null> = []
1502
1502
  const key = queryKey()
1503
- const states: UseQueryResult<number>[] = []
1503
+ const states: Array<UseQueryResult<number>> = []
1504
1504
 
1505
1505
  function Page() {
1506
1506
  const [count, setCount] = React.useState(0)
@@ -1553,7 +1553,7 @@ describe('useQuery', () => {
1553
1553
 
1554
1554
  it('should show placeholderData between multiple pending queries when select fn transform is used', async () => {
1555
1555
  const key = queryKey()
1556
- const states: UseQueryResult<number>[] = []
1556
+ const states: Array<UseQueryResult<number>> = []
1557
1557
 
1558
1558
  function Page() {
1559
1559
  const [count, setCount] = React.useState(0)
@@ -1637,7 +1637,7 @@ describe('useQuery', () => {
1637
1637
 
1638
1638
  it('should transition to error state when placeholderData is set', async () => {
1639
1639
  const key = queryKey()
1640
- const states: UseQueryResult<number>[] = []
1640
+ const states: Array<UseQueryResult<number>> = []
1641
1641
 
1642
1642
  function Page({ count }: { count: number }) {
1643
1643
  const state = useQuery<number, Error>({
@@ -1724,7 +1724,7 @@ describe('useQuery', () => {
1724
1724
 
1725
1725
  it('should not show initial data from next query if placeholderData is set', async () => {
1726
1726
  const key = queryKey()
1727
- const states: DefinedUseQueryResult<number>[] = []
1727
+ const states: Array<DefinedUseQueryResult<number>> = []
1728
1728
 
1729
1729
  function Page() {
1730
1730
  const [count, setCount] = React.useState(0)
@@ -1798,7 +1798,7 @@ describe('useQuery', () => {
1798
1798
 
1799
1799
  it('should keep the previous data on disabled query when placeholderData is set', async () => {
1800
1800
  const key = queryKey()
1801
- const states: UseQueryResult<number>[] = []
1801
+ const states: Array<UseQueryResult<number>> = []
1802
1802
 
1803
1803
  function Page() {
1804
1804
  const [count, setCount] = React.useState(0)
@@ -1900,7 +1900,7 @@ describe('useQuery', () => {
1900
1900
 
1901
1901
  it('should keep the previous data on disabled query when placeholderData is set and switching query key multiple times', async () => {
1902
1902
  const key = queryKey()
1903
- const states: UseQueryResult<number>[] = []
1903
+ const states: Array<UseQueryResult<number>> = []
1904
1904
 
1905
1905
  queryClient.setQueryData([key, 10], 10)
1906
1906
 
@@ -1984,7 +1984,7 @@ describe('useQuery', () => {
1984
1984
 
1985
1985
  it('should use the correct query function when components use different configurations', async () => {
1986
1986
  const key = queryKey()
1987
- const states: UseQueryResult<number>[] = []
1987
+ const states: Array<UseQueryResult<number>> = []
1988
1988
 
1989
1989
  function FirstComponent() {
1990
1990
  const state = useQuery({
@@ -2045,8 +2045,8 @@ describe('useQuery', () => {
2045
2045
 
2046
2046
  it('should be able to set different stale times for a query', async () => {
2047
2047
  const key = queryKey()
2048
- const states1: UseQueryResult<string>[] = []
2049
- const states2: UseQueryResult<string>[] = []
2048
+ const states1: Array<UseQueryResult<string>> = []
2049
+ const states2: Array<UseQueryResult<string>> = []
2050
2050
 
2051
2051
  await queryClient.prefetchQuery({
2052
2052
  queryKey: key,
@@ -2146,7 +2146,7 @@ describe('useQuery', () => {
2146
2146
 
2147
2147
  it('should re-render when a query becomes stale', async () => {
2148
2148
  const key = queryKey()
2149
- const states: UseQueryResult<string>[] = []
2149
+ const states: Array<UseQueryResult<string>> = []
2150
2150
 
2151
2151
  function Page() {
2152
2152
  const state = useQuery({
@@ -2171,7 +2171,7 @@ describe('useQuery', () => {
2171
2171
  describe('notifyOnChangeProps', () => {
2172
2172
  it('should not re-render when it should only re-render only data change and the selected data did not change', async () => {
2173
2173
  const key = queryKey()
2174
- const states: UseQueryResult<string>[] = []
2174
+ const states: Array<UseQueryResult<string>> = []
2175
2175
 
2176
2176
  function Page() {
2177
2177
  const state = useQuery({
@@ -2212,7 +2212,7 @@ describe('useQuery', () => {
2212
2212
  })
2213
2213
  it('should not re-render when it should only re-render on data changes and the data did not change', async () => {
2214
2214
  const key = queryKey()
2215
- const states: UseQueryResult<string>[] = []
2215
+ const states: Array<UseQueryResult<string>> = []
2216
2216
 
2217
2217
  function Page() {
2218
2218
  const state = useQuery({
@@ -2270,7 +2270,7 @@ describe('useQuery', () => {
2270
2270
  describe('function', () => {
2271
2271
  it('should not re-render when it should only re-render on data changes and the data did not change', async () => {
2272
2272
  const key = queryKey()
2273
- const states: UseQueryResult<string>[] = []
2273
+ const states: Array<UseQueryResult<string>> = []
2274
2274
 
2275
2275
  function Page() {
2276
2276
  const state = useQuery({
@@ -2325,7 +2325,7 @@ describe('useQuery', () => {
2325
2325
 
2326
2326
  it('should not re-render when change props are not actively being tracked', async () => {
2327
2327
  const key = queryKey()
2328
- const states: UseQueryResult<string>[] = []
2328
+ const states: Array<UseQueryResult<string>> = []
2329
2329
 
2330
2330
  function Page() {
2331
2331
  const fetchCounterRef = React.useRef(0)
@@ -2603,7 +2603,7 @@ describe('useQuery', () => {
2603
2603
 
2604
2604
  it('should not refetch query on focus when `enabled` is set to `false`', async () => {
2605
2605
  const key = queryKey()
2606
- const queryFn = vi.fn<unknown[], string>().mockReturnValue('data')
2606
+ const queryFn = vi.fn<Array<unknown>, string>().mockReturnValue('data')
2607
2607
 
2608
2608
  function Page() {
2609
2609
  const { data = 'default' } = useQuery({
@@ -2632,7 +2632,7 @@ describe('useQuery', () => {
2632
2632
 
2633
2633
  it('should not refetch stale query on focus when `refetchOnWindowFocus` is set to `false`', async () => {
2634
2634
  const key = queryKey()
2635
- const states: UseQueryResult<number>[] = []
2635
+ const states: Array<UseQueryResult<number>> = []
2636
2636
  let count = 0
2637
2637
 
2638
2638
  function Page() {
@@ -2663,7 +2663,7 @@ describe('useQuery', () => {
2663
2663
 
2664
2664
  it('should not refetch stale query on focus when `refetchOnWindowFocus` is set to a function that returns `false`', async () => {
2665
2665
  const key = queryKey()
2666
- const states: UseQueryResult<number>[] = []
2666
+ const states: Array<UseQueryResult<number>> = []
2667
2667
  let count = 0
2668
2668
 
2669
2669
  function Page() {
@@ -2694,7 +2694,7 @@ describe('useQuery', () => {
2694
2694
 
2695
2695
  it('should not refetch fresh query on focus when `refetchOnWindowFocus` is set to `true`', async () => {
2696
2696
  const key = queryKey()
2697
- const states: UseQueryResult<number>[] = []
2697
+ const states: Array<UseQueryResult<number>> = []
2698
2698
  let count = 0
2699
2699
 
2700
2700
  function Page() {
@@ -2725,7 +2725,7 @@ describe('useQuery', () => {
2725
2725
 
2726
2726
  it('should refetch fresh query on focus when `refetchOnWindowFocus` is set to `always`', async () => {
2727
2727
  const key = queryKey()
2728
- const states: UseQueryResult<number>[] = []
2728
+ const states: Array<UseQueryResult<number>> = []
2729
2729
  let count = 0
2730
2730
 
2731
2731
  function Page() {
@@ -2762,7 +2762,7 @@ describe('useQuery', () => {
2762
2762
 
2763
2763
  it('should calculate focus behaviour for `refetchOnWindowFocus` depending on function', async () => {
2764
2764
  const key = queryKey()
2765
- const states: UseQueryResult<number>[] = []
2765
+ const states: Array<UseQueryResult<number>> = []
2766
2766
  let count = 0
2767
2767
 
2768
2768
  function Page() {
@@ -2813,7 +2813,7 @@ describe('useQuery', () => {
2813
2813
 
2814
2814
  it('should refetch fresh query when refetchOnMount is set to always', async () => {
2815
2815
  const key = queryKey()
2816
- const states: UseQueryResult<string>[] = []
2816
+ const states: Array<UseQueryResult<string>> = []
2817
2817
 
2818
2818
  await queryClient.prefetchQuery({
2819
2819
  queryKey: key,
@@ -2850,7 +2850,7 @@ describe('useQuery', () => {
2850
2850
 
2851
2851
  it('should refetch stale query when refetchOnMount is set to true', async () => {
2852
2852
  const key = queryKey()
2853
- const states: UseQueryResult<string>[] = []
2853
+ const states: Array<UseQueryResult<string>> = []
2854
2854
 
2855
2855
  await queryClient.prefetchQuery({
2856
2856
  queryKey: key,
@@ -3159,7 +3159,7 @@ describe('useQuery', () => {
3159
3159
 
3160
3160
  it('should always fetch if refetchOnMount is set to always', async () => {
3161
3161
  const key = queryKey()
3162
- const states: UseQueryResult<string>[] = []
3162
+ const states: Array<UseQueryResult<string>> = []
3163
3163
 
3164
3164
  await queryClient.prefetchQuery({
3165
3165
  queryKey: key,
@@ -3207,7 +3207,7 @@ describe('useQuery', () => {
3207
3207
 
3208
3208
  it('should fetch if initial data is set', async () => {
3209
3209
  const key = queryKey()
3210
- const states: DefinedUseQueryResult<string>[] = []
3210
+ const states: Array<DefinedUseQueryResult<string>> = []
3211
3211
 
3212
3212
  function Page() {
3213
3213
  const state = useQuery({
@@ -3239,7 +3239,7 @@ describe('useQuery', () => {
3239
3239
 
3240
3240
  it('should not fetch if initial data is set with a stale time', async () => {
3241
3241
  const key = queryKey()
3242
- const states: DefinedUseQueryResult<string>[] = []
3242
+ const states: Array<DefinedUseQueryResult<string>> = []
3243
3243
 
3244
3244
  function Page() {
3245
3245
  const state = useQuery({
@@ -3271,7 +3271,7 @@ describe('useQuery', () => {
3271
3271
 
3272
3272
  it('should fetch if initial data updated at is older than stale time', async () => {
3273
3273
  const key = queryKey()
3274
- const states: DefinedUseQueryResult<string>[] = []
3274
+ const states: Array<DefinedUseQueryResult<string>> = []
3275
3275
 
3276
3276
  const oneSecondAgo = Date.now() - 1000
3277
3277
 
@@ -3311,7 +3311,7 @@ describe('useQuery', () => {
3311
3311
 
3312
3312
  it('should fetch if "initial data updated at" is exactly 0', async () => {
3313
3313
  const key = queryKey()
3314
- const states: DefinedUseQueryResult<string>[] = []
3314
+ const states: Array<DefinedUseQueryResult<string>> = []
3315
3315
 
3316
3316
  function Page() {
3317
3317
  const state = useQuery({
@@ -3344,7 +3344,7 @@ describe('useQuery', () => {
3344
3344
 
3345
3345
  it('should keep initial data when the query key changes', async () => {
3346
3346
  const key = queryKey()
3347
- const states: DefinedUseQueryResult<{ count: number }>[] = []
3347
+ const states: Array<DefinedUseQueryResult<{ count: number }>> = []
3348
3348
 
3349
3349
  function Page() {
3350
3350
  const [count, setCount] = React.useState(0)
@@ -3379,7 +3379,7 @@ describe('useQuery', () => {
3379
3379
  it('should retry specified number of times', async () => {
3380
3380
  const key = queryKey()
3381
3381
 
3382
- const queryFn = vi.fn<unknown[], unknown>()
3382
+ const queryFn = vi.fn<Array<unknown>, unknown>()
3383
3383
  queryFn.mockImplementation(() => {
3384
3384
  return Promise.reject(new Error('Error test Barrett'))
3385
3385
  })
@@ -3416,7 +3416,7 @@ describe('useQuery', () => {
3416
3416
  it('should not retry if retry function `false`', async () => {
3417
3417
  const key = queryKey()
3418
3418
 
3419
- const queryFn = vi.fn<unknown[], unknown>()
3419
+ const queryFn = vi.fn<Array<unknown>, unknown>()
3420
3420
 
3421
3421
  queryFn.mockImplementationOnce(() => {
3422
3422
  return Promise.reject(new Error('Error test Tanner'))
@@ -3462,7 +3462,7 @@ describe('useQuery', () => {
3462
3462
 
3463
3463
  type DelayError = { delay: number }
3464
3464
 
3465
- const queryFn = vi.fn<unknown[], unknown>()
3465
+ const queryFn = vi.fn<Array<unknown>, unknown>()
3466
3466
  queryFn.mockImplementation(() => {
3467
3467
  return Promise.reject({ delay: 50 })
3468
3468
  })
@@ -3559,7 +3559,7 @@ describe('useQuery', () => {
3559
3559
 
3560
3560
  it('should fetch on mount when a query was already created with setQueryData', async () => {
3561
3561
  const key = queryKey()
3562
- const states: UseQueryResult<string>[] = []
3562
+ const states: Array<UseQueryResult<string>> = []
3563
3563
 
3564
3564
  queryClient.setQueryData(key, 'prefetched')
3565
3565
 
@@ -3590,7 +3590,7 @@ describe('useQuery', () => {
3590
3590
 
3591
3591
  it('should refetch after focus regain', async () => {
3592
3592
  const key = queryKey()
3593
- const states: UseQueryResult<string>[] = []
3593
+ const states: Array<UseQueryResult<string>> = []
3594
3594
 
3595
3595
  // make page unfocused
3596
3596
  const visibilityMock = mockVisibilityState('hidden')
@@ -3653,12 +3653,12 @@ describe('useQuery', () => {
3653
3653
  // See https://github.com/tannerlinsley/react-query/issues/195
3654
3654
  it('should refetch if stale after a prefetch', async () => {
3655
3655
  const key = queryKey()
3656
- const states: UseQueryResult<string>[] = []
3656
+ const states: Array<UseQueryResult<string>> = []
3657
3657
 
3658
- const queryFn = vi.fn<unknown[], string>()
3658
+ const queryFn = vi.fn<Array<unknown>, string>()
3659
3659
  queryFn.mockImplementation(() => 'data')
3660
3660
 
3661
- const prefetchQueryFn = vi.fn<unknown[], string>()
3661
+ const prefetchQueryFn = vi.fn<Array<unknown>, string>()
3662
3662
  prefetchQueryFn.mockImplementation(() => 'not yet...')
3663
3663
 
3664
3664
  await queryClient.prefetchQuery({
@@ -3686,10 +3686,10 @@ describe('useQuery', () => {
3686
3686
  it('should not refetch if not stale after a prefetch', async () => {
3687
3687
  const key = queryKey()
3688
3688
 
3689
- const queryFn = vi.fn<unknown[], string>()
3689
+ const queryFn = vi.fn<Array<unknown>, string>()
3690
3690
  queryFn.mockImplementation(() => 'data')
3691
3691
 
3692
- const prefetchQueryFn = vi.fn<unknown[], Promise<string>>()
3692
+ const prefetchQueryFn = vi.fn<Array<unknown>, Promise<string>>()
3693
3693
  prefetchQueryFn.mockImplementation(async () => {
3694
3694
  await sleep(10)
3695
3695
  return 'not yet...'
@@ -3841,7 +3841,7 @@ describe('useQuery', () => {
3841
3841
 
3842
3842
  it('should mark query as fetching, when using initialData', async () => {
3843
3843
  const key = queryKey()
3844
- const results: DefinedUseQueryResult<string>[] = []
3844
+ const results: Array<DefinedUseQueryResult<string>> = []
3845
3845
 
3846
3846
  function Page() {
3847
3847
  const result = useQuery({
@@ -3868,7 +3868,7 @@ describe('useQuery', () => {
3868
3868
 
3869
3869
  it('should initialize state properly, when initialData is falsy', async () => {
3870
3870
  const key = queryKey()
3871
- const results: DefinedUseQueryResult<number>[] = []
3871
+ const results: Array<DefinedUseQueryResult<number>> = []
3872
3872
 
3873
3873
  function Page() {
3874
3874
  const result = useQuery({
@@ -3945,7 +3945,7 @@ describe('useQuery', () => {
3945
3945
  // // See https://github.com/tannerlinsley/react-query/issues/214
3946
3946
  it('data should persist when enabled is changed to false', async () => {
3947
3947
  const key = queryKey()
3948
- const results: DefinedUseQueryResult<string>[] = []
3948
+ const results: Array<DefinedUseQueryResult<string>> = []
3949
3949
 
3950
3950
  function Page() {
3951
3951
  const [shouldFetch, setShouldFetch] = React.useState(true)
@@ -3996,7 +3996,7 @@ describe('useQuery', () => {
3996
3996
 
3997
3997
  it('it should support enabled:false in query object syntax', async () => {
3998
3998
  const key = queryKey()
3999
- const queryFn = vi.fn<unknown[], string>()
3999
+ const queryFn = vi.fn<Array<unknown>, string>()
4000
4000
  queryFn.mockImplementation(() => 'data')
4001
4001
 
4002
4002
  function Page() {
@@ -4090,7 +4090,7 @@ describe('useQuery', () => {
4090
4090
 
4091
4091
  it('should not cause memo churn when data does not change', async () => {
4092
4092
  const key = queryKey()
4093
- const queryFn = vi.fn<unknown[], string>().mockReturnValue('data')
4093
+ const queryFn = vi.fn<Array<unknown>, string>().mockReturnValue('data')
4094
4094
  const memoFn = vi.fn()
4095
4095
 
4096
4096
  function Page() {
@@ -4165,7 +4165,7 @@ describe('useQuery', () => {
4165
4165
  it('should refetch in an interval depending on function result', async () => {
4166
4166
  const key = queryKey()
4167
4167
  let count = 0
4168
- const states: UseQueryResult<number>[] = []
4168
+ const states: Array<UseQueryResult<number>> = []
4169
4169
 
4170
4170
  function Page() {
4171
4171
  const queryInfo = useQuery({
@@ -4231,7 +4231,7 @@ describe('useQuery', () => {
4231
4231
 
4232
4232
  it('should not interval fetch with a refetchInterval of 0', async () => {
4233
4233
  const key = queryKey()
4234
- const states: UseQueryResult<number>[] = []
4234
+ const states: Array<UseQueryResult<number>> = []
4235
4235
 
4236
4236
  function Page() {
4237
4237
  const queryInfo = useQuery({
@@ -4298,7 +4298,7 @@ describe('useQuery', () => {
4298
4298
  it('should refetch if any query instance becomes enabled', async () => {
4299
4299
  const key = queryKey()
4300
4300
 
4301
- const queryFn = vi.fn<unknown[], string>().mockReturnValue('data')
4301
+ const queryFn = vi.fn<Array<unknown>, string>().mockReturnValue('data')
4302
4302
 
4303
4303
  function Disabled() {
4304
4304
  useQuery({ queryKey: key, queryFn, enabled: false })
@@ -4327,7 +4327,7 @@ describe('useQuery', () => {
4327
4327
  it('should use placeholder data while the query loads', async () => {
4328
4328
  const key1 = queryKey()
4329
4329
 
4330
- const states: UseQueryResult<string>[] = []
4330
+ const states: Array<UseQueryResult<string>> = []
4331
4331
 
4332
4332
  function Page() {
4333
4333
  const state = useQuery({
@@ -4366,7 +4366,7 @@ describe('useQuery', () => {
4366
4366
  it('should use placeholder data even for disabled queries', async () => {
4367
4367
  const key1 = queryKey()
4368
4368
 
4369
- const states: { state: UseQueryResult<string>; count: number }[] = []
4369
+ const states: Array<{ state: UseQueryResult<string>; count: number }> = []
4370
4370
 
4371
4371
  function Page() {
4372
4372
  const [count, setCount] = React.useState(0)
@@ -4426,7 +4426,7 @@ describe('useQuery', () => {
4426
4426
  it('placeholder data should run through select', async () => {
4427
4427
  const key1 = queryKey()
4428
4428
 
4429
- const states: UseQueryResult<string>[] = []
4429
+ const states: Array<UseQueryResult<string>> = []
4430
4430
 
4431
4431
  function Page() {
4432
4432
  const state = useQuery({
@@ -4466,7 +4466,7 @@ describe('useQuery', () => {
4466
4466
  it('placeholder data function result should run through select', async () => {
4467
4467
  const key1 = queryKey()
4468
4468
 
4469
- const states: UseQueryResult<string>[] = []
4469
+ const states: Array<UseQueryResult<string>> = []
4470
4470
  let placeholderFunctionRunCount = 0
4471
4471
 
4472
4472
  function Page() {
@@ -4692,7 +4692,7 @@ describe('useQuery', () => {
4692
4692
 
4693
4693
  it('should cancel the query if the signal was consumed and there are no more subscriptions', async () => {
4694
4694
  const key = queryKey()
4695
- const states: UseQueryResult<string>[] = []
4695
+ const states: Array<UseQueryResult<string>> = []
4696
4696
 
4697
4697
  const queryFn: QueryFunction<string, [typeof key, number]> = async (
4698
4698
  ctx,
@@ -4757,7 +4757,7 @@ describe('useQuery', () => {
4757
4757
 
4758
4758
  it('should refetch when quickly switching to a failed query', async () => {
4759
4759
  const key = queryKey()
4760
- const states: UseQueryResult<string>[] = []
4760
+ const states: Array<UseQueryResult<string>> = []
4761
4761
 
4762
4762
  const queryFn = async () => {
4763
4763
  await sleep(50)
@@ -4808,7 +4808,7 @@ describe('useQuery', () => {
4808
4808
 
4809
4809
  it('should update query state and refetch when reset with resetQueries', async () => {
4810
4810
  const key = queryKey()
4811
- const states: UseQueryResult<number>[] = []
4811
+ const states: Array<UseQueryResult<number>> = []
4812
4812
  let count = 0
4813
4813
 
4814
4814
  function Page() {
@@ -4878,7 +4878,7 @@ describe('useQuery', () => {
4878
4878
 
4879
4879
  it('should update query state and not refetch when resetting a disabled query with resetQueries', async () => {
4880
4880
  const key = queryKey()
4881
- const states: UseQueryResult<number>[] = []
4881
+ const states: Array<UseQueryResult<number>> = []
4882
4882
  let count = 0
4883
4883
 
4884
4884
  function Page() {
@@ -4980,7 +4980,7 @@ describe('useQuery', () => {
4980
4980
  })
4981
4981
 
4982
4982
  it('should refetch when changed enabled to true in error state', async () => {
4983
- const queryFn = vi.fn<unknown[], unknown>()
4983
+ const queryFn = vi.fn<Array<unknown>, unknown>()
4984
4984
  queryFn.mockImplementation(async () => {
4985
4985
  await sleep(10)
4986
4986
  return Promise.reject(new Error('Suspense Error Bingo'))
@@ -5152,7 +5152,7 @@ describe('useQuery', () => {
5152
5152
 
5153
5153
  it('should have no error in pending state when refetching after error occurred', async () => {
5154
5154
  const key = queryKey()
5155
- const states: UseQueryResult<number>[] = []
5155
+ const states: Array<UseQueryResult<number>> = []
5156
5156
  const error = new Error('oops')
5157
5157
 
5158
5158
  let count = 0
@@ -5962,7 +5962,7 @@ describe('useQuery', () => {
5962
5962
 
5963
5963
  it('it should have status=error on mount when a query has failed', async () => {
5964
5964
  const key = queryKey()
5965
- const states: UseQueryResult<unknown>[] = []
5965
+ const states: Array<UseQueryResult<unknown>> = []
5966
5966
  const error = new Error('oops')
5967
5967
 
5968
5968
  const queryFn = async (): Promise<unknown> => {