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

isAbstract #391

Closed aerik2 closed 1 year ago

aerik2 commented 1 year ago

Seems like this was removed here: https://github.com/MichalLytek/type-graphql/discussions/1455

But it's still being generated:

src/generated/graphql/resolvers/outputs/WellIdentifierMaxAggregate.ts:7:3 - error TS2345: Argument of type '{ isAbstract: boolean; }' is not assignable to parameter of type 'ObjectTypeOptions'.
  Object literal may only specify known properties, and 'isAbstract' does not exist in type 'ObjectTypeOptions'.

7   isAbstract: true
    ~~~~~~~~~~~~~~~~

src/generated/graphql/resolvers/outputs/WellIdentifierMinAggregate.ts:7:3 - error TS2345: Argument of type '{ isAbstract: boolean; }' is not assignable to parameter of type 'ObjectTypeOptions'.
  Object literal may only specify known properties, and 'isAbstract' does not exist in type 'ObjectTypeOptions'.

7   isAbstract: true
    ~~~~~~~~~~~~~~~~

src/generated/graphql/resolvers/outputs/WellIdentifiersOnOrdersCountAggregate.ts:7:3 - error TS2345: Argument of type '{ isAbstract: boolean; }' is not assignable to parameter of type 'ObjectTypeOptions'.
  Object literal may only specify known properties, and 'isAbstract' does not exist in type 'ObjectTypeOptions'.

7   isAbstract: true
aerik2 commented 1 year ago

Fixed with this script:

const replace = require("replace-in-file");
const results = replace.sync({
  files: "src/generated/graphql/**/*.ts",
  processor: (input) => input.replace(/isAbstract: true/g, ""),
  countMatches: true,
});
juretopolak commented 1 year ago

Same problem here... Any update on this?

MichalLytek commented 1 year ago

That's the issue with breaking changes ๐Ÿ˜”

highruned commented 1 year ago

That's the issue with breaking changes ๐Ÿ˜”

What about throwing it behind a flag?

Also curious because the above PR are your changes, did it happen upstream somewhere?

MichalLytek commented 1 year ago

What about throwing it behind a flag?

We can even try to read the TypeGraphQL version from project package.json and apply that conditional isAbstract generation automatically, so the flag would be used only when the detection mechanism failed.

germanamz commented 1 year ago

@MichalLytek is there something we can do to temporally solve this issue?

germanamz commented 1 year ago

I think this line here type-class.ts:193 should be removed

germanamz commented 1 year ago

@MichalLytek I just created a PR to remove the flag from Model, Input and Output clases. https://github.com/MichalLytek/typegraphql-prisma/pull/393

MichalLytek commented 1 year ago

Closing as resolved by 19e841b ๐Ÿ”’