Core Prisma types (like Middleware Params) unresolved in V6.16.3
Hello everyone,
I'm running into a persistent TypeScript type resolution issue with Prisma and I'm hoping for some insight.
The Problem
Core Prisma types, such as
Prisma.MiddlewareParams, are not being resolved when using version 6.16.3. The TypeScript compiler (tsc) fails with the error TS2694: Namespace 'Prisma' has no exported member 'MiddlewareParams', even in a completely clean project.
Environment
- OS: Windows
- Node.js: v22.19.0
- npm: 10.9.3
- Prisma Version (Failing): 6.16.3
- Prisma Version (Working): 5.17.0
Steps to Reproduce
I can reliably reproduce this with a minimal setup:
1. Initialize a new ES Module TypeScript project:
2. In package.json, add "type": "module".
3. In tsconfig.json, ensure these options are set:
4. Install the latest Prisma version:
5. Use a minimal schema.prisma:
6. Generate the client with npx prisma generate.
7. Create a test.ts file:
8. Running npx tsc --noEmit fails with the TS2694 error.
Conclusion & Workaround
Interestingly, the issue is completely resolved by downgrading to 5.17.0. After running npm install prisma@5.17.0 @prisma/client@5.17.0 and regenerating, the npx tsc command passes with zero errors.
I have not tested every intermediate version, but I can confirm the issue is present in 6.16.3 and absent in 5.17.0. This seems to point to a potential bug or incompatibility in the latest version, perhaps specific to the Node.js v22 + Windows environment.
Has anyone else seen this? Thanks for any help!4 Replies
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the
#ask-ai channel awaits if you're curious!After more work on it, I realized this is the old way to do what I wanted and now I have to use Prisma Extension. I had gotten lost in the docs and somewhere they used the old method which I chose to follow which led me down the wrong path.
Could you share with me the docs you followed?
So that we can investigate if we can improve the docs
I started looking for a way to do logs with Prisma and I found this page : https://www.prisma.io/docs/orm/prisma-client/client-extensions/middleware/logging-middleware
It doesn't say on it that the method has been removed but it says so here :
https://www.prisma.io/docs/orm/prisma-client/client-extensions/middleware
Middleware sample: logging (Reference) | Prisma Documentation
How to use middleware to log the time taken to perform any query.
Middleware (Reference) | Prisma Documentation
Prisma Client middleware allows you to perform actions before or after any query on any model with the prisma.$use method.