DiamondDragon
DiamondDragonā€¢3w ago

Zod Unions appear to break `Table` helper (maybe zodToConvex related?)

https://stack.convex.dev/convex-the-database-that-made-me-switch-careers I'm following the pattern described in this article and getting an type error here. Looks to be since the Table expects a Record while the union produces an array of members. This still works below so i'll do this, but wanted to flag this in case it wasn't known export const TestTable = Table('test', convexTestSchema.members) will same type error
export default defineSchema({
test: defineTable(convexTestSchema),
})
export default defineSchema({
test: defineTable(convexTestSchema),
})
The problem Im trying to solve is dynamic data for a data table where each field/column type can only support specific value types (like a short text field can only support z.string()`. I'm writing all of these combinations as unions and merging the rest of the base table fields in each union member. Seems like teh best way of going about this so its impossibel to accidentally pass in a string value for a boolean field
Convex: The Database that Made Me Switch Careers
Today is my first day working for Convex šŸŽ‰, so I thought Iā€™d take the opportunity to share my thoughts on why I decided to join and what excites me a...
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?