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

Optional fields should use nullable instead of nullish #131

Open
arielpacciaroni opened this issue Jun 16, 2022 · 1 comment
Open

Optional fields should use nullable instead of nullish #131

arielpacciaroni opened this issue Jun 16, 2022 · 1 comment

Comments

@arielpacciaroni
Copy link

If I got the following model:

model User {
  /// other fields
  name    String?
}

It should produce the following zod schema:

const UserSchema = z.object({
  name: z.string().nullable()
})

instead of:

const UserSchema = z.object({
  name: z.string().nullish()
})

I believe that string | null union type (from Prisma exports) suits better than string | undefined | null union type got from Zod schemas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants