Skip to content

Commit ca7d7f5

Browse files
committed
Only 100 spelling corrections for unknown symbols
If your compilation has more than 100 unknown symbols, the problem is missing declarations, not typos.
1 parent 2479c07 commit ca7d7f5

File tree

4 files changed

+536
-1
lines changed

4 files changed

+536
-1
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ namespace ts {
318318
const resolutionResults: boolean[] = [];
319319
const resolutionPropertyNames: TypeSystemPropertyName[] = [];
320320

321+
let suggestionCount = 0;
322+
const maximumSuggestionCount = 100;
321323
const mergedSymbols: Symbol[] = [];
322324
const symbolLinks: SymbolLinks[] = [];
323325
const nodeLinks: NodeLinks[] = [];
@@ -1091,9 +1093,10 @@ namespace ts {
10911093
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
10921094
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)) {
10931095
let suggestion: string | undefined;
1094-
if (suggestedNameNotFoundMessage) {
1096+
if (suggestedNameNotFoundMessage && suggestionCount < maximumSuggestionCount) {
10951097
suggestion = getSuggestionForNonexistentSymbol(originalLocation, name, meaning);
10961098
if (suggestion) {
1099+
suggestionCount++;
10971100
error(errorLocation, suggestedNameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg), suggestion);
10981101
}
10991102
}

0 commit comments

Comments
 (0)