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
export const role = pgEnum("role", ["USER", "ADMIN"]);

// This is what i'm currently using
export enum Role {
  user = "USER",
  admin = "ADMIN"
}

With prisma I would be able to do this on the schema
enum Role {
  USER,
  ADMIN
}

and use it like this inside my typescript
import { Role } from "@prisma/client";

// This has autocomplete functioning perfectly
const firstExample: Role = "USER";
const secondExample: Role = "ADMIN";
const thirdExample: Role = Role.USER;
const fourthExample: Role = Role.ADMIN
Was this page helpful?