From c6f343e266f2ffd3c69711dbf3ea02fdde2d3485 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 7 Nov 2017 14:47:08 -0800 Subject: [PATCH] Improve asserts in getSuggestionForNonexistentSymbol --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4c88bce12f..2990f0cc3f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15291,8 +15291,9 @@ namespace ts { } function getSuggestionForNonexistentSymbol(location: Node, outerName: __String, meaning: SymbolFlags): string { + Debug.assert(outerName !== undefined, "outername should always be defined"); const result = resolveNameHelper(location, outerName, meaning, /*nameNotFoundMessage*/ undefined, outerName, /*isUse*/ false, (symbols, name, meaning) => { - Debug.assert(name !== undefined, "name should always be defined, and equal to " + outerName); + Debug.assertEqual(outerName, name, "name should equal outerName"); const symbol = getSymbol(symbols, name, meaning); // Sometimes the symbol is found when location is a return type of a function: `typeof x` and `x` is declared in the body of the function // So the table *contains* `x` but `x` isn't actually in scope.