-
Notifications
You must be signed in to change notification settings - Fork 12.8k
do not report 'noImplicitReturns' error if inferred return type of th… #5824
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
…e function is void/any
@@ -9871,31 +9871,40 @@ namespace ts { | |||
} | |||
|
|||
// Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions. |
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.
remove "explicitly specified"
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.
'explicitly specified' reflects what is checked in the if
below - if function has explicit type annotation and it is void
/ any
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.
Remove the second "with"
@DanielRosenwasser any other comments? |
return; | ||
} | ||
|
||
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. | ||
// also if HasImplicitReturnValue flags is not set this means that all codepaths in function body end with return of throw | ||
// also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return of throw |
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.
return or throw
👍 |
👍 |
Apart from @yuit's feedback 👍 |
do not report 'noImplicitReturns' error if inferred return type of th…
…e function is void/any. fixes #5814