cornpopguy
cornpopguy9mo ago

Weird type issues

Hi guys, I am experiencing very weird issues which I am not sure if they are related only to my IDE. So I am trying to get a User using a query, as I have additional information about the user stored in the database such as Stripe ID, but my IDE keeps showing that use is any, but whats very weird is when I do not pass the stripeUserId to the stripe create checkout the user suddenly has the proper types. Convex dev does not show any errors in either of those scenarios. Does anyone know why is this happening and how to fix it?
No description
No description
No description
5 Replies
erquhart
erquhart9mo ago
Expand the "dealing with circular type inference" dropdown: https://docs.convex.dev/functions/actions#dealing-with-circular-type-inference
Actions | Convex Developer Hub
Actions can call third party services to do things such as processing a payment
erquhart
erquhart9mo ago
cornpopguy
cornpopguyOP9mo ago
Thank you very much, I will take a look and update my progress here.
erquhart
erquhart9mo ago
I didn't look at your code thoroughly but I'm betting this solves it:
const { stripeUserId }: { stripeUserId: string } = user
const { stripeUserId }: { stripeUserId: string } = user
(if stripeUserId is a Convex id, use an id type)
cornpopguy
cornpopguyOP9mo ago
Explicitly defining Doc<"users"> | null works.
No description

Did you find this page helpful?