[Solved] Tslint weird annoying issue

Every build I do I get this

        Property 'storage' is declared but never used.

  L13:    constructor(public http: Http, private storage: Storage) {
  L14:      storage.get('userDetails').then((userDetails)=>{

Which is kind of funny considering the line below where it’s highlighing is the line that I’m using it.

1 Like

Well, this is the Tslint issue, not the Ionic one, isn’t it?
Also my guess is that you should try to replace “storage.get(…” with “this.storage.get(…” and that would fix it.
EDIT: just checked and - yep!
That works. It’s probably got something to do with the way Tslint checks for the variable usage: my guess is that it collects all words after "this."and then matches that list with declared variables, but it doesn’t account for constructor() case, where you don’t have to specify “this.” context.


Ah sweet thanks man! Has been annoying me for a while xD

1 Like