Skip to content

Conversation

mag123c
Copy link
Contributor

@mag123c mag123c commented Aug 13, 2025

Description

Adds default values to PrismaClient generic parameters to allow extending without explicit generics.

Problem

Previously in v6.14.0, extending PrismaClient resulted in TypeScript error

class MyService extends PrismaClient {}
// TS2508: No base constructor has the specified number of type arguments

Users had to specify all generic parameters

class MyService extends PrismaClient<never, never, false, ExtArgs> {}

Solution

Added default values to constructor generic parameters:

  • Options = Prisma.PrismaClientOptions
  • LogOpts = never

Now this works without errors:

class MyService extends PrismaClient {}

Changes

  • Added default generic parameters in PrismaClientConstructor interface
  • This is a non-breaking change (only adds defaults to existing generics)
  • All existing tests pass

Fixes #27894 Related #27777

@CLAassistant
Copy link

CLAassistant commented Aug 13, 2025

CLA assistant check
All committers have signed the CLA.

Allows extending PrismaClient without explicit generic parameters.
Previously, extending PrismaClient required specifying all generic parameters:
  class MyService extends PrismaClient<never, never, false, ExtArgs> {}

Now works without generics:
  class MyService extends PrismaClient {}

This is a non-breaking change that only adds default values to existing generics.

Fixes prisma#27894
@mag123c mag123c force-pushed the fix/27894-prisma-client-extend-defaults branch from cb8a819 to e60ff34 Compare August 13, 2025 15:01
@hernanistn
Copy link

Working fine here and solved the problem. Thanks!

@aqrln aqrln added this to the 6.15.0 milestone Aug 20, 2025
Copy link
Member

@aqrln aqrln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@aqrln aqrln merged commit eaab3ee into prisma:main Aug 20, 2025
396 checks passed
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prisma 6.14.0 adds breaking change for extending of PrismaClient
4 participants