How do you get defined types for relational queries

If i have a relational query like this
const post = await db.query.posts.findFirst({
    with: {
        comments: true,
    },
});

How do i get the type of post as a defined type to use as a function parameter type for instance?

in prisma land, i manually have to define types like
interface PostWithComments extends Post {
  comments: Comment[];
}

is there a better way to do this?
Was this page helpful?