Hi all. I have a function that wraps around a find...
# prisma-client
s
Hi all. I have a function that wraps around a findUnique function, and that function passes a include query to the findUnique.
Copy code
async getUser(
    userId: string,
    conf?: { include?: Prisma.UserInclude; select?: Prisma.UserSelect }
  ): Promise<User> {
    return await this.prisma.user.findUnique({
      where: { id: userId },
      ...conf
    });
  }
Now, If I do, for example, getUser("id", {include: { posts: true }) , the return type of getUser will be wrong, because it doesn't include the posts relation. I can fix this using generics, but that would mean that I also always have to add the
User
generic. Is there another, better way to fix these return types?
👀 1