__tableName is undefined
Hey, I have a component that takes in an
id: Id<"blocks"> | Id<"tables">;
and I want to have a quick way to check the type of id.
Currently I was doing: const isPageItem = id && id.__tableName === "blocks";
but __tableName
seems to be undefined.
What should I do?2 Replies
Per https://docs.convex.dev/api/modules/values#genericid, IDs are strings at runtime and
__tableName
only exists during TypeScript compilation.
Check out https://discord.com/channels/1019350475847499849/1251451648077987901/1251510531009810472Module: values | Convex Developer Hub
Utilities for working with values stored in Convex.
Asked some questions in that thread