Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TS6133 Error if using typescript with noUnusedLocals and typescript preprocessor

See original GitHub issue

The 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:

@preprocessor typescript
@builtin ""

main -> foo
foo -> "foo"i
bash-3.2$ tsc -v
Version 2.6.1

bash-3.2$ nearleyc -v

bash-3.2$ nearleyc -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:closed
  • Created 6 years ago
  • Comments:11

github_iconTop GitHub Comments

glmdgrielsoncommented, Nov 28, 2017

The official website says:

A // @ts-ignore comment suppresses all errors that originate on the following line.

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.

tjvrcommented, Nov 28, 2017

// @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 👍

Read more comments on GitHub >

github_iconTop 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 >
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found