Let’s say I have an HTMLCollection:
const appElem = document.querySelector("#app");
const appChildren = appElem?.children; // HTML collection
now if I convert this collection to an array it will be Element[]:
const appChildrenArr = appChildren && Array.from(appChildren); // Element[]
But why appChildrenArr has Element[] type, not HTMLElement[] type?
>Solution :
Because they don’t have to be HTMLElements. You could have an SVGElement there, as well, for example.
https://developer.mozilla.org/en-US/docs/Web/API/Element