We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i run into a type error with vue-query in the following example:
vue-query
import { useQuery } from '@tanstack/vue-query' const basket = { fruit: "apple", vegetable: "broccoli" } as const function getBasket<T extends "fruit" | "vegetable">(type: T) { return basket[type] } function useBasket<T extends "fruit" | "vegetable">(type: T) { return useQuery({ queryKey: ["basket", type] as const, // TYPE ERROR queryFn({ queryKey: [, type]}) { return getBasket(type) } }) } const test = getBasket("fruit") const test2 = useBasket("fruit") // UseQueryReturnType<unknown, Error>
see: https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ5wC+cAZlBCHAOQACMAhgHaoMDGA1gPQBuOAtAEcc+KgFgAUBNYRm8AEb1U7dPAC8iUlGTAYALjgAiemDAAbdAYA0cbugDmK+nPP6Dc8q2mngBonEVw0rISEiTIjKwwwDJwDjAAQorKMAA8ACpw6AAeMOiMACaohmTaML4APoa2cU7mBgB8ABQweGDo+mkAlIgScHBQKshQjHAKSioA2i1tALoShCHiYRFRMWjoieOpGdm5BUUGJToVVfaOzhZN0+1wXT3ifQMwQyPr2Lh4jQi9fXBCHwBpdB4fQTNxJFRWODXGb+IpBFiWH59TicX7ojGYuAAPQA-Mi-sI8AAxRhfQmA4Gg6wwwjdb4PDFPF6xFSbZLNVroToEhaMunzRYI+C5FhwdRxdkqRqHLTHHniVHovFSGRi0UwABM4pQGClMBlRzKCqVvxV4iAA
note that the exact same example, when using react-query instead of vue-query, works fine, and does correctly infer UseQueryResult<"apple", Error> - see: https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ5wC+cAZlBCHAOQACMAhgHaoMDGA1gPRTr2swBaAI458VALAAoKawjN4AI3qp26eAF5EpKMmAwAXHABE9MGAA26IwBo4AN3QBzNfQWXDRheVazzwI0RwynCy8lJSJMiM-MBycM4wAELKqjAAPAAqcOgAHjDojAAmqMZkujABAD7GDgmulkYAfAAUMHhg6IYZAJSIUnBwPDDIUIxwSipqANptHQC6UoThkpHRMLFjaOjJk+lZuflFJUZlelU1Ti5uVi2znXA9fZIDQyObGNi4eM0I-QNwIi+AGl0HhDFNPCk1DY4Hc5kESqEWNY-gNOJx-pisdi4AA9AD8qIBojwADFGD9icDQeDbHDCL1fs8sa9RvE1DtUq12uhukSlsyGYtlkj4PkWHBNAlOWpmicdGc+ZJ0ZiCTI5BLxTAAEySlAYGUwOWnCpKlX-NWSIA
react-query
UseQueryResult<"apple", Error>
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ5wC+cAZlBCHAOQACMAhgHaoMDGA1gPQBuOAtAEcc+KgFgAUBNYRm8AEb1U7dPAC8iUlGTAYALjgAiemDAAbdAYA0cbugDmK+nPP6Dc8q2mngBonEVw0rISEiTIjKwwwDJwDjAAQorKMAA8ACpw6AAeMOiMACaohmTaML4APoa2cU7mBgB8ABQweGDo+mkAlIgScHBQKshQjHAKSioA2i1tALoShCHiYRFRMWjoieOpGdm5BUUGJToVVfaOzhZN0+1wXT3ifQMwQyPr2Lh4jQi9fXBCHwBpdB4fQTNxJFRWODXGb+IpBFiWH59TicX7ojGYuAAPQA-Mi-sI8AAxRhfQmA4Gg6wwwjdb4PDFPF6xFSbZLNVroToEhaMunzRYI+C5FhwdRxdkqRqHLTHHniVHovFSGRi0UwABM4pQGClMBlRzKCqVvxV4iAA
UseQueryReturnType<unknown, Error>
vue-query example should work like react-query example
Every time
No response
5.59.13
5.6.3
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
i run into a type error with
vue-query
in the following example:see: https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ5wC+cAZlBCHAOQACMAhgHaoMDGA1gPQBuOAtAEcc+KgFgAUBNYRm8AEb1U7dPAC8iUlGTAYALjgAiemDAAbdAYA0cbugDmK+nPP6Dc8q2mngBonEVw0rISEiTIjKwwwDJwDjAAQorKMAA8ACpw6AAeMOiMACaohmTaML4APoa2cU7mBgB8ABQweGDo+mkAlIgScHBQKshQjHAKSioA2i1tALoShCHiYRFRMWjoieOpGdm5BUUGJToVVfaOzhZN0+1wXT3ifQMwQyPr2Lh4jQi9fXBCHwBpdB4fQTNxJFRWODXGb+IpBFiWH59TicX7ojGYuAAPQA-Mi-sI8AAxRhfQmA4Gg6wwwjdb4PDFPF6xFSbZLNVroToEhaMunzRYI+C5FhwdRxdkqRqHLTHHniVHovFSGRi0UwABM4pQGClMBlRzKCqVvxV4iAA
note that the exact same example, when using
react-query
instead ofvue-query
, works fine, and does correctly inferUseQueryResult<"apple", Error>
- see: https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ5wC+cAZlBCHAOQACMAhgHaoMDGA1gPRTr2swBaAI458VALAAoKawjN4AI3qp26eAF5EpKMmAwAXHABE9MGAA26IwBo4AN3QBzNfQWXDRheVazzwI0RwynCy8lJSJMiM-MBycM4wAELKqjAAPAAqcOgAHjDojAAmqMZkujABAD7GDgmulkYAfAAUMHhg6IYZAJSIUnBwPDDIUIxwSipqANptHQC6UoThkpHRMLFjaOjJk+lZuflFJUZlelU1Ti5uVi2znXA9fZIDQyObGNi4eM0I-QNwIi+AGl0HhDFNPCk1DY4Hc5kESqEWNY-gNOJx-pisdi4AA9AD8qIBojwADFGD9icDQeDbHDCL1fs8sa9RvE1DtUq12uhukSlsyGYtlkj4PkWHBNAlOWpmicdGc+ZJ0ZiCTI5BLxTAAEySlAYGUwOWnCpKlX-NWSIAYour minimal, reproducible example
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ5wC+cAZlBCHAOQACMAhgHaoMDGA1gPQBuOAtAEcc+KgFgAUBNYRm8AEb1U7dPAC8iUlGTAYALjgAiemDAAbdAYA0cbugDmK+nPP6Dc8q2mngBonEVw0rISEiTIjKwwwDJwDjAAQorKMAA8ACpw6AAeMOiMACaohmTaML4APoa2cU7mBgB8ABQweGDo+mkAlIgScHBQKshQjHAKSioA2i1tALoShCHiYRFRMWjoieOpGdm5BUUGJToVVfaOzhZN0+1wXT3ifQMwQyPr2Lh4jQi9fXBCHwBpdB4fQTNxJFRWODXGb+IpBFiWH59TicX7ojGYuAAPQA-Mi-sI8AAxRhfQmA4Gg6wwwjdb4PDFPF6xFSbZLNVroToEhaMunzRYI+C5FhwdRxdkqRqHLTHHniVHovFSGRi0UwABM4pQGClMBlRzKCqVvxV4iAA
Steps to reproduce
UseQueryReturnType<unknown, Error>
Expected behavior
vue-query example should work like react-query example
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
vue-query
TanStack Query version
5.59.13
TypeScript version
5.6.3
Additional context
No response
The text was updated successfully, but these errors were encountered: