sp85S
Convex Community4y ago
21 replies
sp85

Coming from tRPC land I want to set up

Coming from tRPC land, I want to set up end-to-end typing with Convex. What is the suggested pattern for getting this done? For example, I have a function
projects:create
— which has the following signature:

const create = mutationWithSession(async ({ db, auth, session }, project: Pick<Document<"projects">, "name", "description">): Promise<Document<"projects">> => { ... });


But, when I go to call
useMutation("projects:"create")
on the React side of things, the return type is inferred as
Promise<any>
whereas I'd like it to be
Promise<Document<"projects">>
.

Thanks in advance!
Was this page helpful?