forked from ashi009/node-fast-html-parser
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Update querySelector type definition to return null #157
Labels
Comments
Good catch! Thanks for the heads up, Johnny. |
@nonara Thank you for the great library! I depend on it extensively in my project. |
nonara
added a commit
to nonara/node-html-parser
that referenced
this issue
Oct 3, 2021
Merged
Happy to help! @taoqf is the library's author, but I'm sure he'll be glad to hear that it's working well for you! I have this and several other fixes in place in the following PR, but I'll also follow-up in this thread when we have a release ready. |
nonara
added a commit
to nonara/node-html-parser
that referenced
this issue
Oct 3, 2021
Corrected in v5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The TypeScript return type for
querySelector()
isHTMLElement
instead ofHTMLElement | null
.querySelector()
can potentially return null if no elements are found. This will allow code that could throw a null reference exception to pass the type checker.Relevant type definition:
node-html-parser/src/nodes/html.ts
Lines 383 to 386 in 2077d42
Can you set the return type to
HTMLElement | null
?The text was updated successfully, but these errors were encountered: