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

Generated TypeScript files cause compilation errors due to unused variables #130

Open
danisharora099 opened this issue Mar 11, 2024 · 1 comment

Comments

@danisharora099
Copy link

danisharora099 commented Mar 11, 2024

When using the protons library to generate TypeScript files from .proto files, the generated code contains unused variables, specifically the opts parameter in certain functions. This causes compilation errors when running TypeScript with strict checks enabled.

Steps to reproduce:

Expected behavior:

The generated TypeScript files should not cause any compilation errors related to unused variables.

Actual behavior:

The generated TypeScript files contain unused opts parameters in certain functions, leading to compilation errors when strict checks are enabled.

Example error:

src/generated/example.ts:40:29 - error TS6133: 'opts' is declared but its value is never read.
40 }, (reader, length, opts = {}) => {
                       ~~~~

Workarounds:

  • Manually modify the generated TypeScript files to remove the unused variables (not ideal).
  • Use TypeScript compiler options like "skipLibCheck": true or "noUnusedParameters": false to suppress the errors (not recommended for overall project quality).

Proposed Solution

Update the protons library to generate TypeScript code that doesn't include unused variables.

Please let me know if you need any additional information or if there's anything else I can do to assist in resolving this issue. Thank you for your attention and efforts in maintaining the protons library.

cc @achingbrain

@wemeetagain
Copy link
Member

This is definitely not ideal, would defer to achingbrain on whether this is worth pursuing.

Definitely recommend not using typescript for linting, though. Rather use the linter to apply all linter rules.

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