@tanstack/react-query 5.55.4 → 5.56.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-query",
3
- "version": "5.55.4",
3
+ "version": "5.56.1",
4
4
  "description": "Hooks for managing, caching and syncing asynchronous and remote data in React",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  "!build/codemods/**/__tests__"
42
42
  ],
43
43
  "dependencies": {
44
- "@tanstack/query-core": "5.55.4"
44
+ "@tanstack/query-core": "5.56.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/react": "npm:types-react@rc",
@@ -1,8 +1,9 @@
1
- import { describe, expectTypeOf, it } from 'vitest'
1
+ import { describe, expectTypeOf, it, test } from 'vitest'
2
2
  import { QueryClient, dataTagSymbol } from '@tanstack/query-core'
3
3
  import { infiniteQueryOptions } from '../infiniteQueryOptions'
4
4
  import { useInfiniteQuery } from '../useInfiniteQuery'
5
5
  import { useSuspenseInfiniteQuery } from '../useSuspenseInfiniteQuery'
6
+ import { useQuery } from '../useQuery'
6
7
  import type { InfiniteData } from '@tanstack/query-core'
7
8
 
8
9
  describe('queryOptions', () => {
@@ -133,4 +134,22 @@ describe('queryOptions', () => {
133
134
  InfiniteData<string, unknown> | undefined
134
135
  >()
135
136
  })
137
+
138
+ test('should not be allowed to be passed to non-infinite query functions', () => {
139
+ const queryClient = new QueryClient()
140
+ const options = infiniteQueryOptions({
141
+ queryKey: ['key'],
142
+ queryFn: () => Promise.resolve('string'),
143
+ getNextPageParam: () => 1,
144
+ initialPageParam: 1,
145
+ })
146
+ // @ts-expect-error cannot pass infinite options to non-infinite query functions
147
+ useQuery(options)
148
+ // @ts-expect-error cannot pass infinite options to non-infinite query functions
149
+ queryClient.ensureQueryData(options)
150
+ // @ts-expect-error cannot pass infinite options to non-infinite query functions
151
+ queryClient.fetchQuery(options)
152
+ // @ts-expect-error cannot pass infinite options to non-infinite query functions
153
+ queryClient.prefetchQuery(options)
154
+ })
136
155
  })