How to define a type that is the return type of a Convex query
Suppose I want to declare a type at the top of a file like so:
How could i set cFirestoreConfig to the output of a convex query or part of it?
6 Replies
you can use
Doc<"tablename">
the data returned from convex query wraps this type. Doc
can be imported from _generated
folder in convex.Set as in cast the return value of a Convex query to this type?
In your whery you can write
is that what you're talking about?
I want to replace
any
in the code snippet above by the type returned by a specific query. Sometimes these can be pretty complicated types and declaring them manually is a lot of workModule: server | Convex Developer Hub
Utilities for implementing server-side Convex query and mutation functions.
GitHub
llama-farm-chat/shared/worker.ts at bb3955bbb1d7bc2e6d56615e37f4c70...
Use locally-hosted LLMs to power your cloud-hosted webapp - get-convex/llama-farm-chat
beautiful! FunctionArgs is also super useful for defining optimistic update functions somewhere else