MichalLytek / typegraphql-prisma

Prisma generator to emit TypeGraphQL types and CRUD resolvers from your Prisma schema

Home Page:https://prisma.typegraphql.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code is Generated Incorrectly for `0.27.0`

SomeUserNameReally opened this issue · comments

commented

Describe the Bug
Reference prisma/prisma#18342 (comment)

Running

npx prisma generate

or equivalent incorrectly generates prisma/generated/type-graphql/helpers.ts.

The line

const [[key, { value }]] = Object.entries(argument);

at prisma/generated/type-graphql/helpers.ts is structured unexpectedly.

To Reproduce
Generate under these conditions with comment directives, like /// @onDelete(CASCADE), set on schema.prisma.

Expected Behavior
Everything generates and runs without errors.

Logs
Please ask, I will provide as necessary.

Environment (please complete the following information):

  • OS: Manjaro (kernel 6.4.9-1, kde 5.27.7)
  • Node 16.19.1
  • typegraphql-prisma version 0.27.0
  • Prisma version 5.11.1
  • TypeScript version 4.3.2
  • Openssl Version 3.1.x

with comment directives, like /// @onDelete(CASCADE), set on schema.prisma.

I'm not sure what issue do you report. @onDelete is a Prisma attribute that should be placed without docs.
"Comment directives" are only used for @TypeGraphQL ones.

commented

@MichalLytek The main issue here is that we get incorrect code generation on running prisma generate. I looked at the source and I think this may be a bug with how TS types are generated. Not sure. Either way, I don't think comment directives or Prisma attributes have anything to do with it. Sorry if I wasn't clear on this before.