-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Allow missing return for void any union #6512
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
Allow missing return for void any union #6512
Conversation
Hi @masaeedu, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
@masaeedu, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
07f95f3
to
eb87bad
Compare
@@ -3885,7 +3885,7 @@ function g(x: number) { | |||
|
|||
the inferred return type for 'f' and 'g' is Any because the functions reference themselves through a cycle with no return type annotations. Adding an explicit return type 'number' to either breaks the cycle and causes the return type 'number' to be inferred for the other. | |||
|
|||
An explicitly typed function whose return type isn't the Void or the Any type must have at least one return statement somewhere in its body. An exception to this rule is if the function implementation consists of a single 'throw' statement. | |||
An explicitly typed function whose return type isn't the Void type, the Any type, or a union type containing the Void or Any type as a constituent must have at least one return statement somewhere in its body. An exception to this rule is if the function implementation consists of a single 'throw' statement. |
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.
You actually need to update the Word document (which is the authoritative source) and then run the word2md
script to update this file.
Alternatively, just skip this change and log a spec bug to handle the change.
@RyanCavanaugh Any other changes needed to get this merged? |
@mhegazy good with this? |
👍 |
thanks! |
Allow missing return for void any union
Fixes #6326