Nexus-plugin-prisma: Possible Bug : prismaObjectType throw error in TypeScript 3.5.1

Created on 31 May 2019  Â·  15Comments  Â·  Source: graphql-nexus/nexus-plugin-prisma

After update to TypeScript 3.5.1, prismaObjectType throw a error.

TS2590: Expression produces a union type that is too complex to represent.

But downgrade to 3.4.5 it works very well.

Screenshot from 2019-06-01 01-31-22

That's all, I love Nexus and Prisma. :)

notprisma1

Most helpful comment

Workaround seems to be to add the type to the call, like prismaObjectType<‘User’>(...)

All 15 comments

I ran into this as well. I opened an issue here: https://github.com/prisma/nexus/issues/151 but I think I'll close it as this seems like a better location for it.

Having the same issue here. I tried to generate a very simple type:

const MessageType = prismaObjectType({
    name: "Message",
    definition(t) {
        t.prismaFields([
            "createdAt"
        ]);
    }
});

Which generates the same error as above: TS2590: Expression produces a union type that is too complex to represent.
Downgrading to typescript 3.4.5 fixes the error.

Same problem here
image

Anyone know how to make it work with TypeScript 3.5.1 ?

Anyone know how to make it work with TypeScript 3.5.1 ?

I don't know.
For now, I think we still need to use TypeScript 3.4.5

Anyone know how to make it work with TypeScript 3.5.1 ?

I don't know.
For now, I think we still need to use TypeScript 3.4.5

I still cause the same error after I downgrading typescript to v3.4.5

@harvey-woo Same, When I use

yarn add [email protected] -D

The problem still persist in the project.

Duplicate of #291

Hope that fix/update comes along...

Yes, still an issue.

same here

This isn't best way to fix it:

const User = prismaObjectType({
  name: 'User',
  definition(t: any) {
    t.prismaFields([
      'id',
      'name',
      'email',
      {
        name: 'posts',
        args: [],
      }
    ])
  }
})

If you don't wana see the error, add : any.

If you wana code intellisense, delete : any.

Ignore my poor English.

Workaround seems to be to add the type to the call, like prismaObjectType<‘User’>(...)

Workaround seems to be to add the type to the call, like prismaObjectType<‘User’>(...)

It works! But... why??? :sweat_smile:

Workaround seems to be to add the type to the call, like prismaObjectType<‘User’>(...)

Also works for me on [email protected], think this is the best workaround for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RAW4RMCS picture RAW4RMCS  Â·  3Comments

mohe2015 picture mohe2015  Â·  3Comments

ryands17 picture ryands17  Â·  5Comments

franjohn21 picture franjohn21  Â·  4Comments

antonbramsen picture antonbramsen  Â·  4Comments