graphql-editor / graphql-zeus

GraphQL client and GraphQL code generator with GraphQL autocomplete library generation ⚡⚡⚡ for browser,nodejs and react native ( apollo compatible )
https://graphqleditor.com/docs/zeus
MIT License
1.95k stars 106 forks source link

tsc fails #375

Closed Hulkmaster closed 3 weeks ago

Hulkmaster commented 1 year ago

there are some issues from TS for generated files

src/generated/zeus/zeus/index.ts:655:3 - error TS6133: 'type' is declared but its value is never read.

655   type: T,
      ~~~~

src/generated/zeus/zeus/index.ts:656:3 - error TS6133: 'field' is declared but its value is never read.

656   field: Z,
      ~~~~~

src/generated/zeus/zeus/index.ts:710:58 - error TS6133: 'R' is declared but its value is never read.

710             [P in keyof DST]: SRC[P] extends '__union' & infer R ? never : P;
                                                             ~~~~~~~

Found 3 errors in the same file, starting at: src/generated/zeus/zeus/index.ts:655

current workaround: add manually // @ts-nocheck on top of the file

aexol commented 1 year ago

Zeus stops working with every new version of TS

aexol commented 1 year ago

I will try my best to fix

Raphael0010 commented 1 year ago

Hi, same here, did you find somethings better than // @ts-nocheck ?

Edit : I have done this thing to automate it :

  "scripts": {
    "zeus": "zeus schema.gql ../../packages/ --typedDocumentNode && ts-node ../../packages/zeus/fixMe.ts"
  },

fixMe.ts

import * as fs from "fs";

const main = () => {
  const path = "../../packages/zeus/index.ts";
  const data = fs.readFileSync(path).toString().split("\n");
  data.splice(0, 0, "// @ts-nocheck");
  const text = data.join("\n");

  fs.writeFile(path, text, "utf-8", (err) => {
    if (err) {
      throw err;
    }
    console.log("Zeus Patched.");
  });
};

main();