Is there no accelerate client/extended client type?
Hi,
With all the types Prisma provides via generation and all, there's got to be a TypeScript type for an extended (specifically accelerated) client, right? Right?!
If not, what is the easiest way to make a type for it? I like typing everything I can.
Thanks for any help.
24 Replies
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the
#ask-ai channel awaits if you're curious!I might've found a solution for anyone using NestJS, but I'm not quite sure. I just have it in a way where I don't necessarily need to set a type, I don't think.

Nope, nevermind
did you find anything for this? i had the same issue a while back with pulse, ended up with a hacky solution that worked but wasn't ideal
Nope
It's insane how they have all these types/type features yet no official type for extensions, especially their own extension
and honestly due to accelerate costing money, I've decided I'm not going to use it because without the type I found it to be a hassle
sticking with just prisma and postgres
this was my solution
its not at all ideal, but gave me access to pulse within my client
If it works, that's great. I personally like to have and set a type for everything which should be typed for clarity
yeah it gave me types
but i wasn't able to extend the client itself
But I see you didn't set the return type
it was inferred
that's what I mean
I like to set types, even if they are already inferred
OCD thing or something
right, but with this i'd be able to retrieve the type. if i just extended the client, it acted like the extension didn't exist
it's been an issue for a very long time it seems
GitHub
Ability to extend
PrismaClient class w/ Client Extensions before ...Problem Within NestJS, the common solution to implementing an injectable Prisma Client instance is to extend PrismaClient and add the onModuleInit and enableShutdownHooks functions required by Nest...
Oh, yes, yes. That was part of the issue I noticed. I thought that was because of me trying to set a type to it somehow, ykyk
yeah no it just kills the extended part from the returned type somehow
thank you for this. If I decide to end up using it, I'll keep this in mind
yeah, really weird
it's sadly the best solution i found at the time
might revisit and post back here if i figure out a better way
Rip. But yes, do feel free to share a better solution if you find one
here's the full service for context
will do
Neat
If nestjs services are singletons by default, is what you're doing by setting an instance of the client still proper practice?
or redundant
i guess you could ditch that part. just what i'm used to as this was a framework agnostic service i ported to nestjs
I see
nothing wrong with your code, was just curious
yeah no that makes sense
i will check it out again here soon
alr, sounds good