Closed
Description
Some example of code:
class Test {
constructor(elem:Element) {
elem.style.color = 'red';
};
}
let elem = document.querySelector('#test');
let test = new Test(elem);
This produces:
2339 Property 'style' does not exist on type 'Element'.
If I change elem:Element
to elem:HTMLElement
then is says:
2345 Argument of type 'Element' is not assignable to parameter of type 'HTMLElement'. Property 'accessKey' is missing in type 'Element'.
I understand what querySelector
might not always return HTML or SVG elements, but why Element
does not have style property?