Angular 2 - TSLINT - property '...' declared but never used

I have a lot of unused parameters for my functions and constructors, usually underscore does the trick

1), but here I am still getting the error

I tried this (or adding underscore)

/* tslint:disable-next-line:no-unused-variable */
constructor(private el: ElementRef) {  }

      

bad luck

2) how do we deal with parameters that are used only in templates, such errors will be triggered?

I need console.log to faint using a variable

thank

+3


source to share


2 answers


Set this to your tslist.json



"noUnusedLocals": false,
"noUnusedParameters": false

      

0


source


Just set your variable as public

constructor(public el: ElementRef) {  }

      



Source: https://github.com/palantir/tslint/issues/3094

0


source







All Articles