title: Get table row index from row ID in TypeScript
body: <p>I have a table. Each row has an ID. </p>
  
  <p>Can I get the index of any row by using only its ID (no click) and without using a loop?</p>
  
  <p>My HTML looks like this:</p>
  
  <pre><code>&lt;table id="tabId"&gt;
  &lt;tr id="a"&gt;
      &lt;td&gt;ss&lt;/td&gt;
      &lt;td&gt;ss&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr id="b"&gt;
      &lt;td&gt;kk&lt;/td&gt;
      &lt;td&gt;kk&lt;/td&gt;
  &lt;/tr&gt; 
  </code></pre>
  
  <p>I tried this:</p>
  
  <pre><code>var row_number = document.getElementById('a').rowIndex;
  </code></pre>
  
  <p>but it's not working; I get an <a href="https://i.stack.imgur.com/w2f6y.png" rel="nofollow noreferrer">error message</a> saying:</p>
  
  <blockquote>
    <p>[ts] Property 'rowIndex' does not exist on type 'HTMLElement'.</p>
  </blockquote>