Improve asserts in getSuggestionForNonexistentSymbol

This commit is contained in:
Nathan Shively-Sanders 2017-11-07 14:47:08 -08:00
parent 146addc4d5
commit c6f343e266

View file

@ -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.