TypeScript: error TS6133: 'tw' is declared but its value is never read.
See original GitHub issueIf 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.
I could disable this warning in TS, or // @ts-ignore
, but is there a better way of dealing with it?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (7 by maintainers)
Top Results From Across the Web
'X' is declared but its value is never read in TypeScript
To solve the 'is declared but its value is never read' error in TypeScript, prefix any unused parameter name with an underscore, or...
Read more >tslint how to disable error "someVariable is declared but its ...
'myVariable' is declared but its value is never read. I went to the website that documents the rules https://palantir.github.io/tslint/rules/ ...
Read more >TypeScript, disable checks for `declared but its value is never ...
If you declare a variable but never use it, TypeScript will not compile, saying '<variable>' is declared but its value is never read...
Read more >I have this problem: is declared but its value is never read(6133)
Tell us what's happening: I don´t know why my code says to me that a value is declared but its value in never...
Read more >TypeScript errors and how to fix them
You can also follow TypeScript TV on Twitter to stay up to date. ... error TS1371: This import is never used as a...
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 Free
Top 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
My solution is to get rid of
noUnusedLocals
and use ESLint instead for tracking unused variables which can be configured for exceptions.It will work if your CI runs tests & lint before building which is the pretty usual pattern.
Nonetheless, an unused variable is not a reason why build should fail. With tree shaking in place, it will be removed anyway from the resulting bundle. Not that it would matter in case of
twin.macro
at all since it doesn’t have any runtime footprint 😃Ultimately, #70 will be a better solution, of course. Just pointing out that my workaround is pretty good for now.