karlvr / openapi-generator-plus-generators

Other
21 stars 8 forks source link

typescript-fetch-client2 - generated code doesn't compile with noUnusedLocals #32

Open taras opened 2 years ago

taras commented 2 years ago

Related: https://github.com/karlvr/openapi-generator-plus/issues/34

Backstage projects use this config https://github.com/backstage/backstage/blob/master/packages/cli/config/tsconfig.json which includes noUnusedLocals: true.

When I try to compile the project with code generated by typescript-fetch-client2, I get the following errors,

Is it possible to detect when these are not necessary and not generating them?

karlvr commented 2 years ago

@taras thanks for posting this. It's one of those tricky things that I feel can overly complicate the templates to check... I've previously been cheeky with linting and added overrides. Do you know if it's possible to override noUnusedLocals in a particular file? What do you reckon?

taras commented 2 years ago

I tried. I'm not able to override it because Backstage projects are a monorepo with tsconfig.json at the root. I created an example project to show you https://github.com/taras/backstage-openapi-client-scaffolding