useInfiniteQuery not inferring types
on typescript 5.3.2
on @tanstack/react-query@5.8.4
the following is not inferring the correct types for useInfiniteQuery result
the type i get is
does anyone know what's up?
- useQuery infers type correctly (e.g. if i only use queryFn/queryKey as above)
- @tanstack/react-query@4.x infers type correctly
- lowering versions @5.0 and @5.4 does not resolve my issue
- lowering typescript version to 4.9 does not resolve my issue
- made sure vscode is using same ts version as i have installed (rather than vscode version)
8 Replies
skilled-limeOP•3y ago
if i refactor queryFn out it works
adverse-sapphire•3y ago
Show a typescript playground pls
skilled-limeOP•3y ago
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
adverse-sapphire•3y ago
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
adverse-sapphire•3y ago
ah, I know what it is
adverse-sapphire•3y ago
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
adverse-sapphire•3y ago
typescript inference on objects is weird sometimes. So it probably tries to infer the type
TQueryFnData from getNextPageParam instead of querFn if the order is differentskilled-limeOP•3y ago
damn i use a nice eslint fixable rule/plugin which orders my object attributes 😠thanks for looking @TkDodo 🔮 i appreciate it