HTMLElement type for <strong>, <cite>, <article>, and others

Viewed 68

What are the HTMLElement types for elements such as

  • <strong>
  • <cite>
  • <article>
  • and many others

?

According to MDN's HTML elements reference, there are many more elements than there are types under HTMLElement (see this list).

I'm doing some processing on elements with TypeScript, and would like to store references to them with the most specific type possible. While many other elements have clearly-named types (such as HTMLDivElement, HTMLImageElement, and HTMLTableElement), the elements I've listed above do not seem to have any corresponding type.

1 Answers

Its probably just HTMLElement

console.log(document.getElementById('div').constructor);
console.log(document.getElementById('table').constructor);
console.log(document.getElementById('img').constructor);
console.log(document.getElementById('strong').constructor);
console.log(document.getElementById('cite').constructor);
console.log(document.getElementById('article').constructor);
<strong id="strong">strong</strong>
<div id="div">div</div>
<cite id="cite">cite</cite>
<article id="article">article</article>
<table id="table"><tr><td><img id="img" src="https://www.gravatar.com/avatar/460d2e9d0a84c78e6a5c141a51eb3ab9?s=128&d=identicon&r=PG"></td</tr></table>

Related