Rph
Explore posts from serversDTDrizzle Team
•Created by Rph on 9/3/2023 in #help
Get plain typescript type from enum
Hi,
I am working on a NestJS + Drizzle app and I have the following in my schema:
Elsewhere in my code, I am writing a NestJS service that aims to resolve a user based on their current session cookie and I'd like to return the following type:
Is there a way to somehow make the
permissions
field always have a type in sync with the pgEnum? I tried InferColumnType but that clearly isn't correct
Ideally in this scenario, I'd have permissions
be the following type: "admin"|"moderator"|"user"|"banned"
but of course derived somehow from the original enum declaration6 replies