title: How to assert a type of an HTMLElement in TypeScript?
body: <p>I'm trying to do this:</p>
  <pre><code>var script:HTMLScriptElement = document.getElementsByName(&quot;script&quot;)[0];
  alert(script.type);
  </code></pre>
  <p>but it's giving me an error:</p>
  <pre><code>Cannot convert 'Node' to 'HTMLScriptElement': Type 'Node' is missing property 'defer' from type 'HTMLScriptElement'
  (elementName: string) =&gt; NodeList
  </code></pre>
  <p>I can't access the 'type' member of the script element unless I cast it to the correct type, but I don't know how to do this. I searched the docs &amp; samples, but I couldn't find anything.</p>