blitz-js / blitz-js/blitz

support prisma extensions

Open
#4,291 5 comments 1 reaction 0 assignees View on GitHub
status/triage
Dominant language
TypeScript
Stars
14.1k
Forks
803
PR merge metrics
No merged PRs in 30d

Description

### What do you want and why?
handle `$extends()` prisma function (currently errors to `TypeError: (intermediate value).$extends is not a function`
- The types of the __enhanced__ `PrismaClient` break when extensions are added.

![image](https://github.com/blitz-js/blitz/assets/50584606/dcfbb89d-e189-4f61-a3d0-545c5ddd8dfa)
![image](https://github.com/blitz-js/blitz/assets/50584606/d3835ffa-2b50-4446-9876-d25b92ca3c46)

#### (Correct) DB types using `new PrismaClient()` without blitz enhancement (cannot be used due to [this](https://github.com/blitz-js/blitz/issues/4251#issuecomment-1909851287)):
![image](https://github.com/blitz-js/blitz/assets/50584606/cc1d017c-b1f6-4ff7-a8db-caf5992b5d9e)

### Additional Context
The error of using
```ts
const db = new EnhancedPrisma().$extends(...)
```
![image](https://github.com/blitz-js/blitz/assets/50584606/e976123f-5f0e-4816-a1c7-dd53e2bbe96a)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported `TypeError` with `new EnhancedPrisma().$extends(...)` and compare its types with a plain `new PrismaClient()`. Trace how Blitz enhances Prisma and verify that extensions work at runtime and that the enhanced PrismaClient types remain usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.