-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Dom Ready: Add types #19089
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
Dom Ready: Add types #19089
Conversation
packages/dom-ready/src/index.js
Outdated
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.
Subtle behavioral change - this function did not always return void as its type suggested. In this branch, tt would return whatever the callback returned.
Adding the void here so the function always returns 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.
Subtle behavioral change - this function did not always return
voidas its type suggested. In this branch, tt would return whatever the callback returned.Adding the
voidhere so the function always returnsundefined.
I think this syntax can be a little unexpected for some people, or at least it was for me the first times I had seen it, but I think it's a nice simple way to guarantee the return type as undefined, as you suggest.
aduth
left a comment
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 will need a rebase after #19099 was merged (it will take some time for the "include" to populate a bit more before we can avoid such frequent merge conflicts 😬 ).
47bcfaf to
8489ad3
Compare
|
Rebased. |
58117e8 to
ac78666
Compare
Description
Part of #18838
Extracted from #18942
Add types to
dom-readypackage.Testing Instructions:
Verify type checking passes: