typegraphql-prisma: Prisma vs typegraphql-prisma input mismatch

Describe the Bug I have been getting these type errors on the latest typegraphql-prisma updates and can’t figure out if its something to do with my setup or a library issue, so apologies in advance but I didn’t know where else to ask this!

I’m using: typescript: v4.5.2 typegraphql-prisma: v0.18.2 prisma: v3.6.0

 @Query(() => Team, { nullable: true })
  async team(@Args() args: FindFirstTeamArgs): Promise<Team | null> {
    return await prisma.team.findFirst(args)  // <--- Error here
  }

Excessive stack depth comparing types '{ where?: TeamWhereInput | undefined; orderBy?: TeamOrderByWithRelationInput[] | undefined; cursor?: TeamWhereUniqueInput | undefined; take?: number | undefined; skip?: number | undefined; distinct?: ("id" | ... 23 more ... | "updatedAt")[] | undefined; }' and 'TeamFindFirstArgs'.

 Types of property 'AND' are incompatible.
          Type 'TeamWhereInput[] | undefined' is not assignable to type 'Enumerable<TeamWhereInput> | undefined'.
            Type 'TeamWhereInput[]' is not assignable to type 'Enumerable<TeamWhereInput> | undefined'.

The excessive stack depth I’m assuming is due to the recursive nature of the TeamWhereInput, but what’s also weird is i don’t have that error on another project using the exact same environment, so debugging is proving very difficult! Maybe you have some ideas? Also, my server is building on Heroku but not locally, so again seems like maybe a local setup issue?

Thanks!

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 4
  • Comments: 31 (4 by maintainers)

Most upvoted comments

Unfortunately not 😦 leading me to start looking else where for other solutions

Upgraded to Typescript 4.6.2, and I no longer face this issue. Seems like it’s been fixed with https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/#improved-depth-checks

I’m also experiencing this and unfortunately have also ended up putting args as any everywhere it happens. I’m not sure when it started happening for me though and it seems to depend on the complexity of the Prisma models (if they have multiple relationships or not).