TS6133 Error if using typescript with noUnusedLocals and typescript preprocessor
See original GitHub issueThe functions declared in the output parser cause TS6133 errors when attempting to compile with typescript. This is because understandably, not all functions that are provided by builtins and generators are used in a user’s grammar.
How to reproduce:
grammar.ne
@preprocessor typescript
@builtin "postprocessors.ne"
main -> foo
foo -> "foo"i
bash-3.2$ tsc -v
Version 2.6.1
bash-3.2$ nearleyc -v
2.11.0
bash-3.2$ nearleyc grammar.ne -o parser.ts
bash-3.2$ tsc --noUnusedLocals
parser.ts: error TS6133: 'id' is declared but never used.
parser.ts: error TS6133: 'nth' is declared but never used.
parser.ts: error TS6133: '$' is declared but never used.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11
Top Results From Across the Web
Ignore TS6133: "(import) is declared but never used"?
You probably have the noUnusedLocals compiler option turned on in your tsconfig.json . Just turn it off during development.
Read more >karma-typescript-preprocessor2
Leverage the power of gulp-typescript compiler to a simple yet powerfull karma preprocessor plugin. Latest version: 1.2.1, last published: 6 ...
Read more >Error Ts6133: 'Functions' Is Declared But Its Value Is Never ...
If you use tw just as an element prop TypeScript doesn't think it's being used if I have noUnusedLocals: true in my tsconfig.json....
Read more >'X' is declared but its value is never read in TypeScript
When using _myParam instead of myParam , you indicate to TypeScript that you don't intend to use the parameter. You can also get...
Read more >noUnusedLocals and noUnusedParameters
noUnusedLocals and noUnusedParameters With the noUnusedLocals and noUnusedParameters compiler options set, the TypeScript compiler will generate an error if ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The official website says:
So… I’m not so sure. But if it works for you, then I guess that works!
On that note, that solves my problem handily.
// @ts-ignore
seems fine to me. My worry is, will this hide other TS issues? Will think disable type-checking for that line, and is there any way that might cause problems?Happy to merge if not 👍