Skip to content

Commit 932e884

Browse files
committed
fix: createInfiniteQuery could not infer correct types
1 parent e2bf141 commit 932e884

3 files changed

Lines changed: 32 additions & 17 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@rollup/plugin-commonjs": "^22.0.2",
2828
"@rollup/plugin-node-resolve": "^13.2.1",
2929
"@rollup/plugin-replace": "^4.0.0",
30-
"@tanstack/react-query": "^5.59.16",
30+
"@tanstack/react-query": "^5.84.2",
3131
"@testing-library/jest-dom": "^5.16.5",
3232
"@testing-library/react": "^14.0.0",
3333
"@trivago/prettier-plugin-sort-imports": "^4.2.0",

src/types.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,31 @@ type CompatibleWithV4<V5, V4> =
3131
? V5
3232
: V4
3333

34+
type CompatibleWithTwoV5<V6Generics, V5Generics> = UseInfiniteQueryOptions<
35+
unknown,
36+
DefaultError,
37+
unknown,
38+
QueryKey,
39+
unknown
40+
> extends never
41+
? V5Generics
42+
: V6Generics
43+
3444
type CompatibleUseInfiniteQueryOptions<TFnData, TData, TError, TPageParam> =
3545
CompatibleWithV4<
36-
UseInfiniteQueryOptions<
37-
TFnData,
38-
TError,
39-
TData,
40-
TFnData,
41-
QueryKey,
42-
TPageParam
46+
CompatibleWithTwoV5<
47+
UseInfiniteQueryOptions<TFnData, TError, TData, QueryKey, TPageParam>,
48+
// @ts-ignore
49+
UseInfiniteQueryOptions<
50+
TFnData,
51+
TError,
52+
TData,
53+
TFnData,
54+
QueryKey,
55+
TPageParam
56+
>
4357
>,
58+
// @ts-ignore
4459
UseInfiniteQueryOptions<TFnData, TError, TData, TFnData, QueryKey>
4560
>
4661

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,17 +1676,17 @@
16761676
dependencies:
16771677
"@sinonjs/commons" "^3.0.0"
16781678

1679-
"@tanstack/query-core@5.59.16":
1680-
version "5.59.16"
1681-
resolved "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.59.16.tgz#aa4616e8a9c12afeef4cfbf3ed0f55f404d66e67"
1682-
integrity sha512-crHn+G3ltqb5JG0oUv6q+PMz1m1YkjpASrXTU+sYWW9pLk0t2GybUHNRqYPZWhxgjPaVGC4yp92gSFEJgYEsPw==
1679+
"@tanstack/query-core@5.83.1":
1680+
version "5.83.1"
1681+
resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.83.1.tgz#eed82970b30cb24536f561613b5630e03d349628"
1682+
integrity sha512-OG69LQgT7jSp+5pPuCfzltq/+7l2xoweggjme9vlbCPa/d7D7zaqv5vN/S82SzSYZ4EDLTxNO1PWrv49RAS64Q==
16831683

1684-
"@tanstack/react-query@^5.59.16":
1685-
version "5.59.16"
1686-
resolved "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.59.16.tgz#1e701c6e6681965c04aa426df9da54b8edc6db1b"
1687-
integrity sha512-MuyWheG47h6ERd4PKQ6V8gDyBu3ThNG22e1fRVwvq6ap3EqsFhyuxCAwhNP/03m/mLg+DAb0upgbPaX6VB+CkQ==
1684+
"@tanstack/react-query@^5.84.2":
1685+
version "5.84.2"
1686+
resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-5.84.2.tgz#008a8cd26b1e258f87f54cf00cbae14e9c3c84d2"
1687+
integrity sha512-cZadySzROlD2+o8zIfbD978p0IphuQzRWiiH3I2ugnTmz4jbjc0+TdibpwqxlzynEen8OulgAg+rzdNF37s7XQ==
16881688
dependencies:
1689-
"@tanstack/query-core" "5.59.16"
1689+
"@tanstack/query-core" "5.83.1"
16901690

16911691
"@testing-library/dom@^9.0.0":
16921692
version "9.3.0"

0 commit comments

Comments
 (0)