You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ChildNode mixes into CharacterData, Element, and DocumentType, per the spec, but not DocumentFragment. This leaves Document and Attr as the remaining types which extend Node, both of which are not ChildNodes. Also, ShadowRoot extends DocumentFragment but explicitly omitting it may complicate things.
Some methods on
Node
could have a stricter type. Currently, the typings contain:Which allows this code to typecheck:
ChildNode
mixes intoCharacterData
,Element
, andDocumentType
, per the spec, but notDocumentFragment
. This leavesDocument
andAttr
as the remaining types which extendNode
, both of which are notChildNode
s. Also,ShadowRoot
extendsDocumentFragment
but explicitly omitting it may complicate things.I propose making similar typing changes relating to
ChildNode
here, too. Something like:I can send a PR if this change is appropriate.
Related Issues:
microsoft/TypeScript#18194
microsoft/TypeScript#28551
#619
The text was updated successfully, but these errors were encountered: