dannyeloD
Convex Community2y ago
2 replies
dannyelo

Best way to handle this ts error using useQuery()

Hello, I want to know what advise can you give me to handle this situation when using useQuery.

Example code
const customers =
  useQuery(api.sales_channels.getCustomers, {
    organizationId: currentOrganization?._id,
  }) || []


TS Error in (organizationId):
Type 'Id<"organizations"> | undefined' is not assignable to type 'Id<"organizations">'.
  Type 'undefined' is not assignable to type 'Id<"organizations">'.ts(2322)
(property) organizationId: Id<"organizations">
Was this page helpful?