ChildNode/ParentNode no longer extending Node
See original GitHub issueAccording to https://github.com/microsoft/TypeScript/issues/45266, there are some breaks around ChildNode
no longer being a subtype of Node
. This was also mentioned in Google’s 4.4 beta adoption thread (#1067).
Some breaks here
ant-design/ant-design
tsconfig.json
error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.
error TS2339: Property 'nodeType' does not exist on type 'ChildNode'.
error TS2345: Argument of type 'ChildNode' is not assignable to parameter of type 'Node'.
error TS2339: Property 'textContent' does not exist on type 'ChildNode'.
sindresorhus/refined-github
tsconfig.json
error TS2345: Argument of type 'Element | ChildNode' is not assignable to parameter of type 'string | Node'.
In #1067, @saschanaz explained
It’s a mixin interface implemented by some Node interfaces. The correct way to receive Nodes that can be children is
ChildNode & Node
, just likeParentNode & Node
for Nodes that can be parents.
I may be missing some context of why that’s important to have - was there discussion around that? But regardless, I don’t know if we can retroactively make that call. If that’s a thing users need, does it make sense to create a ChildNodeBase
and a ParentNodeBase
?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Parent nodes rendered as normal node when all children are ...
I am currently trying to edit the expand-collapse extension, in order to set collapsed nodes to display: none, instead of removing them from ......
Read more >nodes around parent node, instead of just on one side
It's annoying all the children nodes are on one side of the parent nodes. Ideally nodes are around the parent node for better...
Read more >Please confirm, if i unmanage the parent node, all child nodes ...
Is there a way to view devices in a tree with A node listed, and when you expand it the devices connected to...
Read more >How to identify child nodes using the Linksys app
The parent node is the first node on the list of nodes and all others are considered child nodes. If your other nodes...
Read more >Tree View Only Expanding for First Node - Oracle Communities
The parent node that is expanded continues to operate normally and can be collapsed and expanded however no other parent node can be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I wasn’t sure whether it was worth it to define the new
*Base
types, so I’ve left them out for now. I figured that if it’s really broadly needed, we could introduce them in 4.5.That should implement your idea https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1087#issuecomment-891333791, or did you change your mind?