Has the Prisma client generic type changed? 6.16

Has the Prisma client generic type changed? 6.16
export class Database extends PrismaClient<Prisma.PrismaClientOptions, ‘query|error|info|warn’> {}
export class Database extends PrismaClient<Prisma.PrismaClientOptions, ‘query|error|info|warn’> {}
TS2344: Type "query" | "error" | "info" | "warn" does not satisfy the constraint never Type "query" is not assignable to type never
11 Replies
Prisma AI Help
Prisma AI Help3mo ago
You opted for speed from this bot. Let's conjure up an answer right now! Short answer: yes—there were recent changes around PrismaClient’s generics, and your annotation likely no longer matches the current constraints in 6.16. What changed: - In some versions, extending PrismaClient without (or with outdated) generic defaults caused TS errors after internal refactors. A similar regression in 6.14 was fixed by restoring defaults; mismatches can still surface if you pin older generated client code, import internal types, or use outdated patterns. [Prisma 6.14 issue; comments] What to do now: 1. Prefer options-based inference instead of hard-coding the event union: - Define client options with event-emit logs and let PrismaClient infer the allowed $on events.
import { PrismaClient, Prisma } from '@prisma/client'

const clientOptions = {
log: [
{ emit: 'event', level: 'query' },
{ emit: 'event', level: 'info' },
{ emit: 'event', level: 'warn' },
{ emit: 'event', level: 'error' },
],
} satisfies Prisma.PrismaClientOptions

export class Database extends PrismaClient<typeof clientOptions> {
constructor() {
super(clientOptions)
}
}

import { PrismaClient, Prisma } from '@prisma/client'

const clientOptions = {
log: [
{ emit: 'event', level: 'query' },
{ emit: 'event', level: 'info' },
{ emit: 'event', level: 'warn' },
{ emit: 'event', level: 'error' },
],
} satisfies Prisma.PrismaClientOptions

export class Database extends PrismaClient<typeof clientOptions> {
constructor() {
super(clientOptions)
}
}

This avoids the “Type 'query' is not assignable to type 'never'” error by aligning the generic with your log config. [Issue 19463 comments] 2. If you must annotate explicitly, use the current pattern: - Either specify full options as the first generic, or keep it simple and let the options drive inference (as above). Avoid importing internal types like LogOptions. [Prisma 6.14 issue; 19463 comments] 3. Ensure your generated client is fresh: - Delete node_modules, re-run pri sma generate, and restart your IDE to pick up updated d.ts with correct generic defaults. [Prisma 6.14 comments] Why your current line fails: - The second generic parameter is derived from the log option types. Providing just 'query' | 'error' | 'info' | 'warn' no longer satisfies the inferred constraint in your setup, hence “constraint never.” Using options-based inference or matching the constructor options in the first generic resolves it. [11986; 6279; discussion 22036]
inhanbyeol
inhanbyeolOP3mo ago
I am using version 6.16 and am using a driver adapter. When I tried the fix you mentioned, I lost the adapter type.
Prisma AI Help
Prisma AI Help3mo ago
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Nurul
Nurul3mo ago
Hey! Does the error go away if you downgrade to prisma 6.15.0?
inhanbyeol
inhanbyeolOP3mo ago
This issue also occurs in version 6.15.0 The issue began occurring starting with version 6.14.
No description
No description
inhanbyeol
inhanbyeolOP3mo ago
No description
Nurul
Nurul3mo ago
Hmm, strange! Do you mind creating a GitHub Issue using this link: https://github.com/prisma/prisma/issues So that I can share it with our ORM team internally?
inhanbyeol
inhanbyeolOP3mo ago
Yes, but there's a related issue. Could you please confirm the changes made regarding the above matter? https://github.com/prisma/prisma/issues/27894#issuecomment-2281633797
GitHub
Prisma 6.14.0 adds breaking change for extending of PrismaClient ·...
Bug description After update to Prisma v6.14.0 I face the TS error when I try to extend the PrismaClient: TS2508: No base constructor has the specified number of type arguments. Severity 🚨 Critical...
Nurul
Nurul3mo ago
Yes, but the linked issue is already resolved. Is your repository open source? If yes, could you share the link so that I can reproduce this and check?
inhanbyeol
inhanbyeolOP3mo ago
GitHub
GitHub - inhanbyeol94/prisma-test
Contribute to inhanbyeol94/prisma-test development by creating an account on GitHub.
Nurul
Nurul3mo ago
Thanks! Trying it out

Did you find this page helpful?