diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ed89032b781..00b637301c8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6525,6 +6525,9 @@ module ts { function getReturnTypeFromBody(func: FunctionLikeDeclaration, contextualMapper?: TypeMapper): Type { var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); + if (!func.body) { + return unknownType; + } if (func.body.kind !== SyntaxKind.Block) { var type = checkExpressionCached(func.body, contextualMapper); } diff --git a/tests/cases/fourslash/errorInIncompleteMethodInObjectLiteral.ts b/tests/cases/fourslash/errorInIncompleteMethodInObjectLiteral.ts new file mode 100644 index 00000000000..bd498acec5f --- /dev/null +++ b/tests/cases/fourslash/errorInIncompleteMethodInObjectLiteral.ts @@ -0,0 +1,5 @@ +/// + +//// var x: { f(): string } = { f( } + +verify.numberOfErrorsInCurrentFile(1); \ No newline at end of file