Closed
Description
In TypeScript, getElementById
returns a HTMLElement
, while the standard mandates it to return a Element
in order to account for more general situations like SVGElement
and alike.
This change seems to be refused by TypeScript, for many years now:
- document.getElementById is not correctly typed microsoft/TypeScript#60996 (comment)
Node.parentElement
should beElement | null
, notHTMLElement | null
microsoft/TypeScript-DOM-lib-generator#1151 (comment)- Update lib dom for 4.2 microsoft/TypeScript#42067 (comment)
- Node.parentElement should be Element, not HTMLElement microsoft/TypeScript#4689 (comment)