Open danielrentz opened 2 years ago
Interface NodeList is correctly typed
NodeList
interface NodeList { item(index: number): Node | null; }
but interface NodeListOf is missing the null type:
NodeListOf
null
interface NodeListOf<TNode extends Node> extends NodeList { item(index: number): TNode; }
therefore TSC does not warn about missing null checks:
const node = document.childNodes.item(999999).firstChild;
Agree 👍🏻 open to changes here
Changed my mind after thinking about it in https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1268, this is probably too big of an ecosystem break
Interface
NodeList
is correctly typedbut interface
NodeListOf
is missing thenull
type:therefore TSC does not warn about missing null checks: