-
Notifications
You must be signed in to change notification settings - Fork 456
make location.reload() return never #1544
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
|
Thanks for the PR! This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged. |
|
Thanks! LGTM. |
|
Merging because @saschanaz is a code-owner of all the changes - thanks! |
|
In my test this does not change compile behavior with code after that. |
|
Hey @HolgerJeromin, it works for me, here's an example in the TS Playground which correctly errors with |
|
Interesting. My code uses the declare interface Location {
reload(): never;
}
window.location.reload()
console.log("...") |
|
What about iframes? const frame = window[0]
frame.location.reload() // never
console.log("Is it really unreachable?") |
|
@k-yle , |
|
You can use the playground link above to test yourself... |
|
And yes, seems that we can have executable code after |
Which is a good thing BTW, because an iframe reload does not break code flow in runtime of the top frame. |
|
Oh yes, I did not think about the iframe case, I guess I'll have to revert this. |
This reverts commit b24e2d7.
|
Reverting this in #1545 to prevent unexpected breakage. Feel free to file an issue to continue the discussion. |
Co-authored-by: saschanaz <[email protected]>
writing code after
location.reload()is very likely a mistake, since the code will probably never run.So this PR changes
location.reload()to returnnever, akin toprocess.exit()in node