title: Create a HTMLHeadingElement in TypeScript
body: <p>I am trying to create a <code>HTMLHeadingElement</code>. To do that I use:</p>
  
  <pre><code>const myHeading: HTMLHeadingElement = document.createElement("h3");
  </code></pre>
  
  <p>So this works perfectly. But when I try to create this element more dynamically, I fail doing so:</p>
  
  <pre><code>const level: number = 3;
  const headingLevel: string = "h" + level;
  const myHeading: HTMLHeadingElement = document.createElement(headingLevel);
  </code></pre>
  
  <p>So, it looks like essentially the same thing, but apparently it isn't. The error I get when hovering <code>myHeading</code> is:</p>
  
  <blockquote>
    <p>Type 'HTMLElement' is not assignable to type 'HTMLHeadingElement'</p>
  </blockquote>
  
  <p>In the first example, though, the method <code>createElement("h3")</code> right away returns the type <code>HTMLHeadingElement</code>.</p>
  
  <p>Now, my first question is, how are these two commands different? And if not clear then, how can I get the same result within <code>myHeading</code> in the second example as shown in the first example?</p>