mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
In getSuggestionForNonexistentSymbol, guard name against undefined
This commit is contained in:
@@ -15064,7 +15064,10 @@ namespace ts {
|
||||
|
||||
function getSuggestionForNonexistentSymbol(location: Node, name: __String, meaning: SymbolFlags): string {
|
||||
const result = resolveNameHelper(location, name, meaning, /*nameNotFoundMessage*/ undefined, name, /*isUse*/ false, (symbols, name, meaning) => {
|
||||
// `name` from the callback === the outer `name`
|
||||
// NOTE: `name` from the callback is supposed to === the outer `name`, but is undefined in some cases
|
||||
if (name === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user