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?
5 Replies
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
And Michael's super helpful illustration of the problem: https://discord.com/channels/1019350475847499849/1202973619970375710/1203111559002333234
Thank you very much, I will take a look and update my progress here.
I didn't look at your code thoroughly but I'm betting this solves it:
(if stripeUserId is a Convex id, use an id type)
Explicitly defining
Doc<"users"> | null
works.