Skip to content

[BUG]: pgEnum enumValues does not return as literal value #3926

Open
@lontrr

Description

What version of drizzle-orm are you using?

0.38.3

What version of drizzle-kit are you using?

0.22.7

Other packages

No response

Describe the Bug

import { z } from "zod";
import { pgEnum } from "drizzle-orm/pg-core";

export const genderEnum = pgEnum("gender", ["female", "male", "other"]);

export const testTable = pgTable("testTable ", {
  id: uuid("id").defaultRandom().primaryKey(),
 gender: genderEnum("gender"),
});

const testRow = await db.query.testTable.findFirst();

In this scenario testRow.gender would be typed as a string instead of ["female", "male", "other"]

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions