Skip to content

unwrap promised typed in async function before doing 'noImplicitRetur…#7450

Merged
vladima merged 1 commit into
masterfrom
noImplicitReturnsInAsync
Mar 9, 2016
Merged

unwrap promised typed in async function before doing 'noImplicitRetur…#7450
vladima merged 1 commit into
masterfrom
noImplicitReturnsInAsync

Conversation

@vladima
Copy link
Copy Markdown
Contributor

@vladima vladima commented Mar 9, 2016

fixes #7446

Comment thread src/compiler/checker.ts
else if (compilerOptions.noImplicitReturns && !maybeTypeOfKind(returnType, TypeFlags.Void | TypeFlags.Any)) {
else if (compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) {
// The function has a return type, but the return statement doesn't have an expression.
error(node, Diagnostics.Not_all_code_paths_return_a_value);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not related, but this error message could be better. may be Implicit returns not allowed.

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Mar 9, 2016

👍

vladima added a commit that referenced this pull request Mar 9, 2016
unwrap promised typed in async function before doing 'noImplicitRetur…
@vladima vladima merged commit 5d5fee2 into master Mar 9, 2016
@vladima vladima deleted the noImplicitReturnsInAsync branch March 9, 2016 20:42
@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 disallows empty return statement in an async function that does not explicitly return Promise<void>

3 participants