#Output type of api ref
4 messages · Page 1 of 1 (latest)
Hi @clever vapor. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The TypeScript alias to get the output (return) type of a Convex function given its reference (e.g., api.fn.reference) is FunctionReturnType. You use it like this:
import { FunctionReturnType } from "convex/server";
type Output = FunctionReturnType<typeof api.fn.reference>;
This will infer the return type of the referenced Convex function automatically, providing end-to-end type safety in your code FunctionReturnType docs.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@clever vapor Kapa.ai is still learning and improving, please let me know how I did by reacting below.