Skip to content

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

Merged
merged 3 commits into from
Dec 1, 2015

Conversation

vladima
Copy link
Contributor

@vladima vladima commented Nov 29, 2015

…e function is void/any. fixes #5814

@@ -9871,31 +9871,40 @@ namespace ts {
}

// Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove "explicitly specified"

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the second "with"

@vladima
Copy link
Contributor Author

vladima commented Nov 30, 2015

@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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return or throw

@sandersn
Copy link
Member

👍

@yuit
Copy link
Contributor

yuit commented Nov 30, 2015

👍

@DanielRosenwasser
Copy link
Member

Apart from @yuit's feedback 👍

vladima added a commit that referenced this pull request Dec 1, 2015
do not report 'noImplicitReturns' error if inferred return type of th…
@vladima vladima merged commit b40079e into master Dec 1, 2015
@vladima vladima deleted the implicitReturnInferredVoid branch December 1, 2015 04:36
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

noImplicitReturns compile error for void functions as of 1.8.0-dev.20151126
5 participants