-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NestJS usage #7
Comments
This is correct. Because const prisma = new PrismaClient()
// Declare an extended client that has pagination applied
const prismaA = prisma.$extends(pagination)
// prisma remains unchanged
// prismaA has pagination applied You need to use a modified instance with the extension applied. Unfortunately, I don't have enough experience with NestJS to know how to do this. |
Ah, i see
and usage
Many Thanks, for this awesome lib |
@gagermaniac Wouldn't that extend the prisma client every time you call the
Probably this can be done too to install the extension to all models in the PrismaService installing the extension only once. |
Ok. I think I got it. This installs the extension to all models.
Usage:
|
@jdavidferreira did you get the typing to working. When I do |
It's necessary to type the variable |
@hisabimbola, @btd1337
Usage:
|
@jdavidferreira the issue is not this. The real problem is that if you write your code without typing the Therefore, it is necessary to type the
|
@hisabimbola Did you try my new implementation? My previous example was wrong and the |
@jdavidferreira what TypeScript version is your project using? And could you please share your tsconfig? This behavior is not occurring in my VSCode IDE. |
That could be the issue. I'm using the TypeScript version tsconfig.json
|
@jdavidferreira I found the problem: The property I removed this property, and autocomplete now works correctly, but the code break with errors: |
@btd1337 You have to type all those fields. 😬 It will be tedious but you will have more type safety throughout your project. |
Hi @jdavidferreira ! Im following this setup :
But the prismaExtended type is not being infered. This is my tsconfig.json (i remove the "noImplicitAny": false value)
Demo: demo_prisma_2.webmIs there another configuration to check? |
Look at this |
Sorry for making an issue here,
is there any way to use this extension on nestjs?
I've been using it like this
but it doesn't seems work as it say
Property 'paginate' does not exist on type 'GetModel<InstancesDelegate<RejectOnNotFound | RejectPerOperation, DefaultArgs>, unknown>'
The text was updated successfully, but these errors were encountered: