I had this pretty simple method:

// Loop over the themes
const activeIdWasFound = false;

const elementRef = this.elementRef.nativeElement.querySelector(`[id="${activeValue[0]}"]`);
if (elementRef !== null) {
    activeIdWasFound = true;
}
       

Solution

You used it in if - else statement but after that it's not used again. That's why PHPStorm shows notice. Replace const with let

// Loop over the themes
let activeIdWasFound = false;

const elementRef = this.elementRef.nativeElement.querySelector(`[id="${activeValue[0]}"]`);
if (elementRef !== null) {
    activeIdWasFound = true;
}