Open harrytranimpt opened 5 days ago
System: OS: Linux 5.15 Debian GNU/Linux 12 (bookworm) 12 (bookworm) CPU: (12) x64 AMD Ryzen 5 4600H with Radeon Graphics Memory: 392.87 MB / 3.83 GB Container: Yes Shell: 5.9 - /usr/bin/zsh Binaries: Node: 20.16.0 - ~/.config/nvm/versions/node/v20.16.0/bin/node Yarn: 1.22.22 - ~/.config/nvm/versions/node/v20.16.0/bin/yarn npm: 10.8.2 - ~/.config/nvm/versions/node/v20.16.0/bin/npm pnpm: 9.7.0 - ~/.config/nvm/versions/node/v20.16.0/bin/pnpm npmPackages: @tanstack/react-query: ^5.59.19 => 5.59.19 @trpc/client: 11.0.0-rc.608 => 11.0.0-rc.608+f75de97b3 @trpc/react-query: 11.0.0-rc.608 => 11.0.0-rc.608+f75de97b3 @trpc/server: 11.0.0-rc.608 => 11.0.0-rc.608+f75de97b3 next: 15.0.2 => 15.0.2 react: 19.0.0-rc-77b637d6-20241016 => 19.0.0-rc-77b637d6-20241016 typescript: ^5.6.3 => 5.6.3
useSuspenseInfiniteQuery does not allow a custom select method's return type. It works with useInfiniteQuery.
useSuspenseInfiniteQuery
select
useInfiniteQuery
const result = trpc.greeting.useSuspenseInfiniteQuery( {}, { getNextPageParam: (p) => p.nextCursor, select: (data) => 1, // Type 'number' is not assignable to type '{ pages: { text: string; nextCursor: number; }[]; pageParams: (number | null | undefined)[]; }'. } );
It works with useInfiniteQuery:
const result2 = trpc.greeting.useInfiniteQuery( {}, { getNextPageParam: (p) => p.nextCursor, select: (data) => 1, // No error } );
https://stackblitz.com/edit/github-t3rzii?file=src%2Fpages%2Findex.tsx
Use the select method with a useSuspenseInfiniteQuery, and return a new data
No response
My guess would be that this broke due to the type changes in this RQ PR: https://github.com/TanStack/query/pull/8082. Can take a look later
Provide environment information
Describe the bug
useSuspenseInfiniteQuery
does not allow a customselect
method's return type. It works withuseInfiniteQuery
.It works with
useInfiniteQuery
:Link to reproduction
https://stackblitz.com/edit/github-t3rzii?file=src%2Fpages%2Findex.tsx
To reproduce
Use the select method with a useSuspenseInfiniteQuery, and return a new data
Additional information
No response
π¨βπ§βπ¦ Contributing
Funding