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

TypeScript says PrismaClient can't receive omit property (enabled in client) #24651

Closed
jpenna opened this issue Jun 26, 2024 · 1 comment
Closed

Comments

@jpenna
Copy link

jpenna commented Jun 26, 2024

Hello!

I've enabled omitApi like it is said in the docs:

# schema.prisma
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["omitApi"]
}

But when using the omit for globally hiding a field, TS complains and Prisma fails to build the client:

import { PrismaClient } from '@prisma/client';

export const prisma = new PrismaClient({
  omit: { user: { password: true } },
   // ^ here
});

TS error:

Object literal may only specify known properties, and 'omit' does not exist in type 'Subset<PrismaClientOptions, PrismaClientOptions>'

Prima error:

PrismaClientConstructorValidationError: Unknown property omit provided to PrismaClient constructor.

Obs: I regenerated the client and restarted the TS Server.

@jpenna
Copy link
Author

jpenna commented Jun 26, 2024

I was using an outdated version of prisma 🤦
The version with global support for omit was just released this week...

@jpenna jpenna closed this as completed Jun 26, 2024
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

1 participant