DT
Drizzle Team•13mo ago
Jakesdoc

Generate relational select types

In prisma, you can do something like Prisma.GetUserPayload<{include: {posts: true}}> and that will give you the type of the user and include the posts. Is there something like this in drizzle?
1 Reply
Json 👺
Json 👺•4w ago
https://github.com/drizzle-team/drizzle-orm/issues/695 Still an open issue but some have shared some solutions. Hopefully in the next year we'll get a native option. Really hoping for it.
GitHub
Implement infering table model with relations · Issue #695 · driz...
Prisma API: import { Prisma } from '@prisma/client' // 1: Define a type that includes the relation to Post const userWithPosts = Prisma.validator<Prisma.UserDefaultArgs>()({ include...

Did you find this page helpful?