mst-gql icon indicating copy to clipboard operation
mst-gql copied to clipboard

Update generator to not generate unused imports / exports

Open ivkirill opened this issue 5 years ago • 3 comments

Add // @ts-nocheck in header for generated *.ts files, for prevents tsc errors.

ivkirill avatar Apr 26 '20 21:04 ivkirill

this might be an issue with your ts config, I'm not seeing errors in our example project or in my project that uses mst-gql. If you are having issues more information would be helpful.

chrisdrackett avatar May 07 '20 15:05 chrisdrackett

I'm using CRA in project.

Common errors like: TS6133: 'RootStore' is declared but its value is never read. TS6192: All imports in import declaration are unused.

I can't add rules into tsconfig, cause it will be affect all project.

And I can't exclude generated directory using tsconfig exclude property:

Any files that are referenced by files included via the "files" or "include" properties are also included. Similarly, if a file B.ts is referenced by another file A.ts, then B.ts cannot be excluded unless the referencing file A.ts is also specified in the "exclude" list.

ivkirill avatar May 07 '20 21:05 ivkirill

ah, so this has to do with the generated model code. Ideally our generator should not be generating unused imports. I'm going to rename this issue to cover that issue.

For now you can safely remove unused imports in the generated code to remove typescript errors. Unfortunately you'll need to do this every time you run scaffold, but hopefully we can get to cleaning this up!

chrisdrackett avatar May 07 '20 22:05 chrisdrackett