DCsanD
Convex Community3y ago
6 replies
DCsan

Argument of type 'unknown' is not assignable to parameter of type 'Id<string>'.

The basic tutorials don't work with typescript. eg
https://docs.convex.dev/functions/query-functions#query-arguments-and-responses

when I try to make a query that takes params, in typescript, eg like this:

export const cards = query(async ({ db }, { id }) => {
  return await db.get(id);
});


I get this error:

Argument of type 'unknown' is not assignable to parameter of type 'Id<string>'.

how do i pass params to a query in a way that compiles?
Queries are the bread and butter of your backend API. They fetch data from the
Queries | Convex Developer Hub
Was this page helpful?