title: Compare HTMLElement with ElementRef
body: <p>I am working in angular 5. I am invoking a function on <code>keyup</code> and passing an event to it. I also have another reference like this</p>
  
  <pre><code>@ViewChildren('list') list: QueryList&lt;ElementRef&gt;;
  </code></pre>
  
  <p>I am trying to check their ids and based on that do something. </p>
  
  <p>But I am getting an error as </p>
  
  <blockquote>
    <p>[ts] Operator '===' cannot be applied to types 'string' and 'HTMLAnchorElement'</p>
  </blockquote>
  
  <p>Can someone tell me how to typecast and check their ids. Thanks. I am new to this.</p>
  
  <pre><code>handleEvent(event: KeyboardEvent) {
  const tabKey = 9;
  if (event.keyCode === tabKey &amp;&amp; !event.shiftKey) {
    const el: HTMLElement = event.target as HTMLElement;
  
    if (el.id === &lt;HTMLAnchorElement&gt;this.list.first.nativeElement.id) {
  
      }
    }
  } 
  </code></pre>