From fbda0bdd94498d47cb4f5078565f2b6d1447e9c9 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 8 Mar 2016 11:46:47 -0800 Subject: [PATCH] Adding another check for undefined --- src/compiler/checker.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f18239d5e74..e2c57ffeaa1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7165,7 +7165,11 @@ namespace ts { if (!leftmostIdentifier) { return type; } - const declaration = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostIdentifier)).valueDeclaration; + const leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostIdentifier)); + if (!leftmostSymbol) { + return type; + } + const declaration = leftmostSymbol.valueDeclaration; if (!declaration || declaration.kind !== SyntaxKind.VariableDeclaration && declaration.kind !== SyntaxKind.Parameter && declaration.kind !== SyntaxKind.BindingElement) { return type; }