tRPCttRPC
Powered by
XenostarX
tRPC•3y ago•
1 reply
Xenostar

Strange trpc types

Hello, I just installed a fresh
trpc
trpc
project with
prisma
prisma
and
next
next
.
I have a prisma schema such as:
model Example {
    id        String   @id @default(cuid())
    createdAt DateTime @default(now())
    updatedAt DateTime @updatedAt
}
model Example {
    id        String   @id @default(cuid())
    createdAt DateTime @default(now())
    updatedAt DateTime @updatedAt
}

and a router procedure like:
export const exampleRouter = createTRPCRouter({
  getAll: publicProcedure.query(async ({ ctx }) => {
    const values = await ctx.prisma.example.findMany();
    return values;
  }),
});
export const exampleRouter = createTRPCRouter({
  getAll: publicProcedure.query(async ({ ctx }) => {
    const values = await ctx.prisma.example.findMany();
    return values;
  }),
});

The issue is that the TS type if we hover the mouse over
values
values
is strange:
const values: Prisma.PrismaPromise<(GetResult<{
    id: string;
    createdAt: Date;
    updatedAt: Date;
}, unknown> & {})[]>
const values: Prisma.PrismaPromise<(GetResult<{
    id: string;
    createdAt: Date;
    updatedAt: Date;
}, unknown> & {})[]>

In the past it would have looked like:
const values: Example[]
const values: Example[]

Has anyone else noticed this behavior in their projects? Is this expected behavior? I noticed this in my personal project when I updated to the latest prisma packages. It may be related to 4.16.x versions of prisma. I was curious if others were having this issue?
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

strange behaviour with t3 trpc starter
Rohit VermaRRohit Verma / ❓-help
2y ago
tRPC is butchering object types in return types
BertBBert / ❓-help
3y ago
TRPC EXPORT API TYPES BE to FE
<DxD/><<DxD/> / ❓-help
3y ago
How can I generate trpc Generic Types?
DangerZoneDDangerZone / ❓-help
3y ago