1

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.

poa
  • 269
  • 1
  • 4
  • 13
  • Timestamps from this and GH post are close so you may have found this, but info here: https://github.com/prisma/nexus-prisma/issues/291 (recommendation is dropping to TS 3.4.x – Firo Sep 17 '19 at 23:27
  • thank you for this input this will work, but i want to work with the latest version of typescript – poa Sep 18 '19 at 22:18

2 Answers2

1

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*/}) 
0

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.

Firo
  • 15,448
  • 3
  • 54
  • 74
  • 1
    there are tons of issues still to be fixed in order to stabilize Prisma2, at first i wanted to develop with prisma2 but as nothing is clear to me when there will be a stable version of Prisma that can be used in production – poa Sep 19 '19 at 07:19