mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Merge pull request #3352 from Microsoft/checkFunctionReturnExpression
Always check return expressions when type checking a file
This commit is contained in:
@@ -7657,6 +7657,15 @@ module ts {
|
||||
}
|
||||
|
||||
if (node.body) {
|
||||
if (!node.type) {
|
||||
// There are some checks that are only performed in getReturnTypeFromBody, that may produce errors
|
||||
// we need. An example is the noImplicitAny errors resulting from widening the return expression
|
||||
// of a function. Because checking of function expression bodies is deferred, there was never an
|
||||
// appropriate time to do this during the main walk of the file (see the comment at the top of
|
||||
// checkFunctionExpressionBodies). So it must be done now.
|
||||
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
|
||||
}
|
||||
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
checkSourceElement(node.body);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user