The "omit" field type is not generated for Prisma client - v6.2.0
While attempting to play with the new
omit
exclusion feature (here: https://www.prisma.io/docs/orm/prisma-client/queries/excluding-fields#excluding-a-field-globally-using-omit), I found what may be a generator bug.
I'm seeing the typescript error of, Object literal may only specify known properties, and 'omit' does not exist in type 'Subset<PrismaClientOptions, PrismaClientOptions>'
when attempting to use
new PrismaClient({ omit: { user: password } })
.
I'm using prisma version 6.2.0 and I have already regenerated the client multiple times.
The generated node_modules/.prisma/client/index.d.ts
file doesn't included the omit
field, despite it existing here: https://github.com/prisma/prisma/blob/6.2.0/packages/client/src/runtime/getPrismaClient.ts#L134C2-L134C27
It does generate if I use the previewFeatures = ["omitApi"]
feature flag, but npx prisma generate
throws a warning of Preview feature "omitApi" is deprecated. The functionality can be used without specifying it as a preview feature.
.
Am I doing something wrong, or is this just a bug?Excluding fields | Prisma Documentation
This page explains how to exclude sensitive fields from Prisma Client
GitHub
prisma/packages/client/src/runtime/getPrismaClient.ts at 6.2.0 · pr...
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB - prisma/prisma
20 Replies
Hey @pilfer
Let me try
With omitApi, in index.d.ts I'm seeing it generated in
export interface PrismaClientOptions { ...
as the last field. If I comment out that flag, it disappears 😄It seems to work as expected for me in the latest version. I don't have
omitApi
in my schema.prismathat's so weird - maybe there's something else in my env that is causing the issue
I'm using a devenv.sh environment, node v22.10.0 - generating via
npx prisma generate
Try deleting node_modules and reinstalling the dependencies?
Already did haha
Out of curiosity, what version of typescript are you using?
5.7.2
same here. the only logical conclusion that we can responsibly draw from this experience is that my editor is in fact haunted by one or more ghosts
Haha, try restarting the Typescript server in your IDE?
I tried that as well as removing the prisma npx command itself to no avail. I think we can chalk this up to a nonstandard dev env + ghosts lol
I'm running into the same issue. I did see that in some places of the code it does still reference the previewFeature through
context.isPreviewFeatureOn('omitApi')
. I cleared npm cache, deleted node_modules and reinstalled. It also is picked up by npx tsc
so it's not just VSCode for me. I'll try an empty project as wellI'm getting it on a new project as well, by following the first four steps of the quickstart; https://www.prisma.io/docs/getting-started/quickstart-sqlite
Quickstart with TypeScript & SQLite | Prisma Documentation
Get started with Prisma ORM in 5 minutes. You will learn how to send queries to a SQLite database in a plain TypeScript script using Prisma Client.
Will create an issue for it
GitHub
Typing error when using omit without preview feature · Issue #25992...
Bug description TypeScript will throw an error when trying to use the global omit feature in 6.2.0 without the feature on. The error it throws is Object literal may only specify known properties, a...
Nice - glad to know it wasn't just me! Thanks for raising the issue
@WikiRik Thank you for creating the issue. It seems like an issue our ORM team needs to look into.
Although I wasn't able to reporduce it, I see a few users have reported the same thing, so there is obviously something going wrong which we need to check.
@pilfer @WikiRik Prisma release 6.2.1 is out. This should fix the issue you were observing
https://github.com/prisma/prisma/releases/tag/6.2.1
Thank you for bringing this to our attention 🙏
GitHub
Release 6.2.1 · prisma/prisma
Today we are releasing the 6.2.1 patch release to address an issue with some of the omitApi preview feature checks having been accidentally omitted when making the feature GA. Now it is fully funct...
Works great for me, thanks for the quick work!
Beautiful! Thank you @Nurul and team. What a pleasant surprise to wake up to ❤️