MichalLytek / typegraphql-prisma

Prisma generator to emit TypeGraphQL types and CRUD resolvers from your Prisma schema
https://prisma.typegraphql.com
MIT License
891 stars 113 forks source link

Code is Generated Incorrectly for `0.27.0` #415

Closed SomeUserNameReally closed 9 months ago

SomeUserNameReally commented 1 year ago

Describe the Bug Reference https://github.com/prisma/prisma/issues/18342#issuecomment-1476980186

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):

MichalLytek commented 1 year ago

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.

SomeUserNameReally commented 1 year ago

@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.

MichalLytek commented 9 months ago

Unable to reproduce 🔒