-
Notifications
You must be signed in to change notification settings - Fork 94
fix: restore more Node and ProcessingInstruction types #726
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #726 +/- ##
=======================================
Coverage 94.36% 94.36%
=======================================
Files 8 8
Lines 2093 2094 +1
Branches 537 538 +1
=======================================
+ Hits 1975 1976 +1
Misses 118 118 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest some changes.
assert(fakeNode.nodeType, undefined); | ||
assert(fakeNode.lineNumber, undefined); | ||
assert(fakeNode.columnNumber, undefined); | ||
assert(fakeNode.textContent, undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't really make sense since no matter what property you try to access it's always gonna be undefined
since fakeNode
is just an empty object. You should probably just use an Element
or something else that extends Node
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in the comment above this section, yes, there is no actual instance of type Node
, but these assertions should make sure that those properties are available on the type Node
, not only on some sub type/class.
When using assert
, the CodeQL checks will complain that the values are unused.
And yes, I'm asserting that the value is undefined, which only makes sense in the context of this assertion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I think I get it now... so basically if you would try to do this: assert(fakeNode.doesntExist, undefined)
JS would be fine with it but since the TS compiler checks this the check would fail correctly.
Btw other than that it looks good to me and can be released. #728 is building on this branch ;) |
@Ponynjaa thx for the review, I integrated your suggestions. |
and avoid redundant uncheckable conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me!
Node.nodeType
Node.textContent
Node.columnNumber
Node.lineNumber
ProcessingInstruction.data
(inherited fromCharacterData
)ProcessingInstruction.target
fixes #725