Node.childNodes return type appears to be slightly inaccurate #18194
Labels
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Fixed
A PR has been merged for this issue
Help Wanted
You can do this
Suggestion
An idea for TypeScript
Milestone
Greetings!
Ran into this earlier today and I'm wondering if it's a bug or if I'm just mistaken for what I assumed would be returned.
Below is a snapshot of the definition of
Node
.https://github.com/Microsoft/TypeScript/blob/c7b4ed3a91964915b953b34ad2ae72f36e7d6efe/lib/lib.dom.d.ts#L8260-L8265
Currently,
Node.childNodes
returns aNodeList
which is mostly correct. However, wouldn't it be more accurate to instead return aNodeListOf<Node & ChildNode>
so that theremove
method is exposed?Example of the issue:
Happy to submit a PR for this if needed (I'm going to also submit one for the issue I opened yesterday when I get some spare time this weekend).
Thanks in advance 😄
The text was updated successfully, but these errors were encountered: