How to type a Table

I want my data access layer to depend on my entities layer. I want to define a ts type for an entity, say a Student type, and then implement a drizzle table that's based off that type. Something like const studentTable = sqliteTable<Student>(...) would be perfect the syntax imo. I would expect this to throw errors if it was missing a field or incorrectly typed field.

Is there a way to do this atm? Maybe a hack with drizzle-zod?
Was this page helpful?