Issues With Prisma Return types
I have really dug deep to try and find a solution online before coming here but I really can't find anything. I'm seeing an issue where the return types I get back from calling prisma are not showing the actual model type, but instead showing this strange 'GetResult' type. Has anyone encountered this before? Again apologies if this is a low brow question I truly could not find anything online when searching GetResult type and prisma.
14 Replies
Did you try regenerating the types and restarting ur ts server/vs code
I get this all the time as well. But I think this just resolves to the actual type you need later?
Did you try to call this from your frontend to see how the type gets infered/
Or try using RouterOutputs
@lopen3 hey thank you so much for the response, greatly appreciated. Yep I have tried regenerating the prisma types, restarting my ts server and vs code. I even messed with the Tsserver: Use Syntax Server setting (changing it from auto to always) but the only impact that had was making everything type any lol. Again thank you for responding.
Try typing it manually then
Const test: type = ....
You can import the typw from prisma client
so I gave that a shot and what I'm noticing now is that the type that im importing from prisma actually has the strange GetResult wrapper...so maybe an issue with my schema.prisma file...hmmmm
Trying creating an actual data
Like make a new modal and run the migration and then try it on the new model
okay sounds good, thanks again 🙇♂️
damn so i made this, ran npx prisma db push, but same result when importing it into the server the type is: (alias) type TestModel = runtime.GetResult<{
id: string;
howdy: string;
}, unknown> & {}
import TestModel
Try
Or try deleting your node modules folder and do fresh install
damn so i tried running that. Then i tried deleting the node modules and running yarn and then npx prisma generate, then i tried the reverse deleting the node modules then running npx prisma generate and then yarn. All returned the same result, Its strange though because using an old t3 project i have on my lapot i can copy my code into there and the types are correct, but if i spin up a new t3 project and drop this same code in there it has the same problem....
Hey
I am having this same issue!
Is this maybe related to Prisma V.5?
Try v4 or previous version
I have the same issue using Prisma
4.16.2
I know this is an old thread but I had the same issue, downgrading seems to have fixed it for me. Even tho its not a good solution, it seems like its my only. Didnt test a lot with different versions but it seems like:
pnpm up --save-exact [email protected] @prisma/[email protected]
worked for me