TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

`Attr.cloneNode()` should return `Attr`, not `Node`

Open fonsp opened this issue 4 years ago • 1 comments

Expectation

Attr extends Node, but Attr.cloneNode() returns a new Attr, not just a Node.

Chrome dev tools:

Schermafbeelding 2022-02-04 om 23 47 06

Reality

But in lib.dom.d.ts, its return type is Node. This can give false errors, like this example from the VS Code TS linter:

Schermafbeelding 2022-02-04 om 23 43 52

fonsp avatar Feb 04 '22 22:02 fonsp

It's just special case of https://github.com/microsoft/TypeScript/issues/283 #811 was reverted as it broke libs in DefinitelyTyped

IllusionMH avatar Feb 23 '22 16:02 IllusionMH