typegraphql-prisma icon indicating copy to clipboard operation
typegraphql-prisma copied to clipboard

Generate only imports which will be used

Open capaj opened this issue 4 years ago • 4 comments

Is your feature request related to a problem? Please describe. Currently generated files often have imports that are not used anywhere image

Describe the solution you'd like Unused import would be stripped/never even generated

Describe alternatives you've considered stripping it myself using eslint

Additional context

capaj avatar Aug 16 '21 22:08 capaj

I tried to use ts-morph optimize functionality but it's super super slow that it's unusable 😞

MichalLytek avatar Aug 17 '21 07:08 MichalLytek

Yeah if there was a way to do this, that would be great! currently generating the source files is not an option as it then fails all eslint/ts checks.

JClackett avatar Aug 20 '21 12:08 JClackett

@JClackett You should just ignore that generated source files folder in eslint or put a dedicated tsconfig for that folder to supress the unused stuff errors.

ts-morph optimize functionality is unusable and doing such import optimization manually in the code is a tedious task - there are plenty of issues with more priority, so unless someone make a PR with that, it won't happen soon 😞

MichalLytek avatar Nov 10 '21 12:11 MichalLytek

Yeah for sure this isn't high priority, so all good! :)

JClackett avatar Nov 10 '21 12:11 JClackett