Strange trpc types with latest create-t3-app example app
Hello, I just installed a fresh
create-t3-app
with prisma
, tailwind
, and trpc
.
If we navigate to the example getAll
query in server/api/routers/example.ts
, and modify it as such:
The issue is that the TS type if we hover the mouse over values
is strange:
In the past it would have looked like:
Has anyone else noticed this behavior in their project? Is this expected behavior? I noticed this in my personal project when I updated to the latest prisma
packages. So I created a fresh create-t3-app
to see if it was happening there as well, and was able to verify it was. It seems to potentially be related to prisma 4.16.x versions.9 Replies
Seems like potentially Prisma 4.16.X+ is having this issue.
This part is written incorrectly.
1st why are you declaring values if you return a query again? You are douing double queries.
2nd you aren't awaiting queries which are async
Better example
Thanks! I totally get that this is not fully correct. My focus though is on the
type
of values
, which seems to be incorrect. I refactored the code and you can see I am still getting this when hovering my house over values
. What I would expect to see is Example[]
.I see now... I tried it myseld and get the same result
However, when calling it it's return as normal
^ I returned only 1 object
So yea... idk why it's shown like that but it works as expected 👍
GitHub
FindMany returns wrong type after extending prisma client · Issue #...
Bug description Types inference breaks when you pass query as any to the findMany function in extended prisma client; const result = prisma.model.findMany(query as any); const id = result[0].id; /*...
This is a known bug... hopefully will be fixed soon
Thank you Julie!!