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] @zod.custom.omit([input]) generates TS errors #243

Open
Darkbound opened this issue Feb 26, 2024 · 0 comments
Open

[BUG] @zod.custom.omit([input]) generates TS errors #243

Darkbound opened this issue Feb 26, 2024 · 0 comments
Assignees
Labels
bug (unconfirmed) Could be a bug

Comments

@Darkbound
Copy link

Darkbound commented Feb 26, 2024

Describe the bug
I am trying to do inline validation with rich comments and zod, most of it works fine, but the omitting yields TS errors

generator client {
  provider = "prisma-client-js"
}

generator zod {
  provider         = "zod-prisma-types"
  output           = "../schemas/"
  useMultipleFiles = true
}

datasource db {
  provider  = "postgresql"
  url       = env("POSTGRES_PRISMA_URL") // uses connection pooling
  directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
}

model TimeEntry {
  /// @zod.custom.omit([input])
  id   String @id @default(cuid())
  name String
}

For example here, just by trying to omit the id field for the inputs, I get 30 TS errors.

It works, zod does omit the field, but I cant pass TS checks.

Screenshots
image

Package versions (please complete the following information):

  • zod: 3.21.1
  • prisma: 5.6
  • zod-prisma-types: 3.1.6

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (unconfirmed) Could be a bug
Projects
None yet
Development

No branches or pull requests

2 participants