-
-
Couldn't load subscription status.
- Fork 3.5k
Closed
Labels
Description
Describe the bug
import { useQuery } from "@tanstack/vue-query";
const query = useQuery({
queryKey: ["hello"] as const,
queryFn: (params) => {
return Promise.resolve("hello");
},
select: (data) => {
//^? `unknown` but should be `string`
return data;
},
});Your minimal, reproducible example
Steps to reproduce
- Open minimal repro
- Inspect type of
dataparameter. - Compare type of
datawith and without arguments inqueryFn. datashould be of typestringbut infers tounknown.
Expected behavior
I'm expecting data in select transformer to have its type inferred from queryFn return.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
vuev3.3.11
Tanstack Query adapter
vue-query
TanStack Query version
v5.14.0
TypeScript version
v5.3.3
Additional context
Seems not to be an issue in @tanstack/react-query. Same repro