-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Function that always throws is not inferred as having never
return type
#16608
Comments
This is by design. We had it the way you suggest originally but I was too much of a breaking change. See #8767 for more details. |
@ahejlsberg Could we have an off-by-default compiler flag that unifies this behavior? |
Perhaps only class methods should get |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
I really like @basarat's suggestion. |
TypeScript Version: 2.5.0-dev.20170618
Code
Expected behavior:
Inferred return type of both functions is
never
Actual behavior:
Only the return type of the second function is
never
. The return type offail1
is inferred asvoid
.The text was updated successfully, but these errors were encountered: