Cannot query with sum type variant index
Say I have
This works, but trying to query using that index fails with a type error
I expected the above to work as though the following were true (though the following is not valid)
So I found this somewhat surprising.
4 Replies
Yeah this seems like an issue in our types, and I'm trying out a fix for this -- thanks for reporting.
Also to be clear, I believe this is just an issue with the types and the query is valid and should behave as expected? (if we put a
// @ts-expect-error
or casted to get around the type issue?)Yes, this is just a typing issue! Tested and confirmed that the query is otherwise valid and behaves as expected.
I think this typing issue is fixed in convex 1.1!
Thank you @sshader, I'll report here when I get a chance to test it out!
Upgraded and I no longer see a type error, thanks again!