poa
poa

Reputation: 369

prismaObjectType usage produces a union type that is too complex to represent

I have a node project written in typescript with graphQl and prisma-nexus.

the usage of prismaObjectType from import { prismaObjectType } from 'nexus-prisma' produces a union type that is too complex to represent.

I can still use the project in dev but when I build it using tsc -p the build fails with this error error TS2590: Expression produces a union type that is too complex to represent.

does anyone come across this issue ? any idea how to solve it or at least to ignore it when building the project ?

many thanks in advance.

Upvotes: 1

Views: 2991

Answers (2)

user3221618
user3221618

Reputation: 43

This solution was posted on an issue for nexus-schema-plugin-prisma on GitHub.

Where ever you use prismaExtendType, also pass a string of the object type as a type argument. For example, if you have a prisma "User" model type, change:

prismaObjectType({/*config object*/}) 

to:

prismaObjectType<"User">({/*config object*/}) 

Upvotes: 1

Firo
Firo

Reputation: 15566

To expand on my comment a bit:

There is currently a GitHub issue filed for this. The recommended solution is to drop Typescript to 3.4.X.

Prisma 1 is currently being phased out in favor of v2 / Photon. Although continued maintenance is planned, it looks like most resources are being shifted away:

Prisma 1 will continue to be maintained. However, most Prisma engineering resources will go into the development of Prisma 2

There will be no new features developed for Prisma 1.

I do hope this issue is fixed, but I think the recommended solution is upgrading to Photon and moving away from Prisma 1.

Upvotes: 0

Related Questions