beerman
beerman3w ago

getting type of query

+page.svelte
const accounts = useQuery(api.accounts.list, {});
const accounts = useQuery(api.accounts.list, {});
component
interface Props {
accounts: ;
}
let { accounts }: Props = $props();
interface Props {
accounts: ;
}
let { accounts }: Props = $props();
FunctionReturnType<api.accounts.list> returns the type of the data but doesn't include the query states. And UsePaginatedQueryReturnType<api.accounts.list> creates a type mismatch. What's the correct way to do this?
3 Replies
Convex Bot
Convex Bot3w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
ballingt
ballingt3w ago
The correct way to do what, to type the prop? this is the code, sounds like it'd be helpful to export this? https://github.com/get-convex/convex-svelte/blob/main/src/lib/client.svelte.ts#L46 but for now you could use that type
GitHub
convex-svelte/src/lib/client.svelte.ts at main · get-convex/convex-...
Contribute to get-convex/convex-svelte development by creating an account on GitHub.
ballingt
ballingt3w ago
Alternatively, just pass the data instead of all the loading state, or if you want loading state, do the query in the component where you need the data. A nice thing about Convex is not needing to pass these props around.

Did you find this page helpful?