Skip to content

Attr.cloneNode() should return Attr, not Node #1260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fonsp opened this issue Feb 4, 2022 · 1 comment
Open

Attr.cloneNode() should return Attr, not Node #1260

fonsp opened this issue Feb 4, 2022 · 1 comment

Comments

@fonsp
Copy link

fonsp commented Feb 4, 2022

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

@IllusionMH
Copy link
Contributor

It's just special case of microsoft/TypeScript#283
#811 was reverted as it broke libs in DefinitelyTyped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants