Making a enum/union type like in prisma, but with drizzle
I have this a role
pgEnum
and I want to make a enum type that is also a union type, like what happens in prisma when you make a enum
With prisma I would be able to do this on the schema
and use it like this inside my typescript
5 Replies
The best solution I've found so far is:
But if I wanted to use the enum version I would need to import
RoleEnum
, which is something i don't need to do with prisma.
I don't need to, but I also want to find a way to use something like InferModel
on my pgEnum
to make the enum but I don't know exactly how the PgEnum
type worksHey did you wind up figuring out how to do this?
For now I just have a union
I will ping you when I get time to get the exact type
@lermatroid this is what i'm using for now
Thanks!
No problem!