Decorated private propoerty flagged as unused with `noUnusedLocals:true`
See original GitHub issuenoUnusedLocals:true
import { Component } from '@angular/core';
@Component({
selector: 'my-component',
template: `
{{text}}
`,
})
export class MyComponent {
@Input()
private text: string;//'text' is declared but never used
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:11
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Decorated private propoerty flagged as unused with ... - GitHub
I believe that this is almost impossible to predict all template usage (if we are talking not only about decorated properties/functions).
Read more >"parserOptions.project" has been set for @typescript-eslint ...
I've been trying to integrate eslint with typescript but it doesn't seem to recognize files under the src folder even though I listed...
Read more >Ask Question
"noUnusedLocals": true, /* Enable error reporting when a local variables ... using the 'esModuleInterop' flag 3 import BN from 'bn.js';.
Read more >Overview - TypeScript
Additionally, TypeScript 3.4 introduced the --incremental flag for saving ... each constituent of T has a done property that's specifically true or false...
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 problem is really annoying for angular projects. Especially for re-usable components lib when some properties/methods should be private, but they are called only from component’s template. This causes “unused local” error for such a methods/variables. So, if there is no possibility to check templates then the best solution is to introduce some “ignore” comment to avoid compiler errors in such a cases.
@andrui Just remember that if you ever try to use the angular AOT compiler, which is essentially a subset of typescript, all of your private fields used in template bindings will cause compilation errors and you have to rewrite your code.
This is off topic, since it isn’t typescript at all at that point, but I thought I’d mention it since it seems to nullify the use case for many users.