mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Fix "Cannot find name 'global'. Did you mean 'global'?" (#42262)
* Add tests for "Cannot find name 'global'. Did you mean 'global'?" * Fix "Cannot find name 'global'. Did you mean 'global'?" * Add an additional test case for spelling suggestions of "global". * Name the boolean for suggestions being global scope augmentations.
This commit is contained in:
1 parent
0383b5cb4c
commit
424b805d61
21 files changed
+184
No files matched your search
@@ -2028,6 +2028,10 @@ namespace ts {
|
||||
let suggestion: Symbol | undefined;
|
||||
if (suggestedNameNotFoundMessage && suggestionCount < maximumSuggestionCount) {
|
||||
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
||||
const isGlobalScopeAugmentationDeclaration = suggestion && suggestion.valueDeclaration && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
||||
if (isGlobalScopeAugmentationDeclaration) {
|
||||
suggestion = undefined;
|
||||
}
|
||||
if (suggestion) {
|
||||
const suggestionName = symbolToString(suggestion);
|
||||
const diagnostic = error(errorLocation, suggestedNameNotFoundMessage, diagnosticName(nameArg!), suggestionName);
|
||||
|
||||
Reference in new issue
Block a user