Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
taras opened this issue Mar 5, 2022 · 2 comments

Comments

@taras
Copy link

taras commented Mar 5, 2022

Related: karlvr/openapi-generator-plus#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,

  • error TS6133: 'COLLECTION_FORMATS' is declared but its value is never read.
  • error TS6133: 'configuration' is declared but its value is never read.
  • error TS6133: 'mimeType' is declared but its value is never read.
  • error TS6133: 'dateToString' is declared but its value is never read.

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

@karlvr
Copy link
Owner

karlvr commented Mar 8, 2022

@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
Copy link
Author

taras commented Mar 8, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants