Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: drizzle-zod not overriding optional #2755

Closed
Jamess-Lucass opened this issue Aug 5, 2024 · 3 comments
Closed

[BUG]: drizzle-zod not overriding optional #2755

Jamess-Lucass opened this issue Aug 5, 2024 · 3 comments
Assignees
Labels
bug Something isn't working drizzle/zod

Comments

@Jamess-Lucass
Copy link

What version of drizzle-orm are you using?

0.32.2

What version of drizzle-kit are you using?

0.23.2

Describe the Bug

When wanting to override a nullable column, drizzle-zod does not respect when you completely override this with a zod type that is not nullable.

const userTable = pgTable("users", {
  name: text("name"),
});

const userSchema = createInsertSchema(userTable, {
  name: z.string(),
});

type UserSchema = TypeOf<typeof userSchema>;
// type UserSchema = {
//   name?: string | null | undefined; // nullable, despite me overriding it with z.string()
// }

Expected behavior

I would expect UserSchema to result in

type UserSchema = {
  name: string
}

Environment & setup

drizzle-zod 0.5.1
drizzle-orm 0.32.2
drizzle-kit 0.23.2

@Jamess-Lucass Jamess-Lucass added the bug Something isn't working label Aug 5, 2024
@yantakus
Copy link

UP. I can confirm this problem exists in the latest drizzle-zod.

@jimmysafe
Copy link

still no update on this?

@AndriiSherman
Copy link
Member

This one was fixed in the latest drizzle-zod@0.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working drizzle/zod
Projects
None yet
Development

No branches or pull requests

5 participants