Skip to content

Commit e4f380c

Browse files
author
Andy Hanson
committed
Code review
1 parent 4dc9423 commit e4f380c

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/compiler/checker.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,16 @@ namespace ts {
314314
getSuggestionDiagnostics: file => {
315315
return (suggestionDiagnostics.get(file.fileName) || emptyArray).concat(getUnusedDiagnostics());
316316
function getUnusedDiagnostics(): ReadonlyArray<Diagnostic> {
317+
if (file.isDeclarationFile) return emptyArray;
318+
317319
checkSourceFile(file);
318320
const diagnostics: Diagnostic[] = [];
319321
Debug.assert(!!(getNodeLinks(file).flags & NodeCheckFlags.TypeChecked));
320-
if (!file.isDeclarationFile) {
321-
checkUnusedIdentifiers(allPotentiallyUnusedIdentifiers.get(file.fileName)!, (kind, diag) => {
322-
if (!unusedIsError(kind)) {
323-
diagnostics.push({ ...diag, category: DiagnosticCategory.Suggestion });
324-
}
325-
});
326-
}
322+
checkUnusedIdentifiers(allPotentiallyUnusedIdentifiers.get(file.fileName)!, (kind, diag) => {
323+
if (!unusedIsError(kind)) {
324+
diagnostics.push({ ...diag, category: DiagnosticCategory.Suggestion });
325+
}
326+
});
327327
return diagnostics;
328328
}
329329
},

src/compiler/core.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,7 @@ namespace ts {
16231623
messageText: text,
16241624
category: message.category,
16251625
code: message.code,
1626-
unused: message.unused,
1626+
reportsUnused: message.unused,
16271627
};
16281628
}
16291629

@@ -1654,7 +1654,7 @@ namespace ts {
16541654
messageText: text,
16551655
category: message.category,
16561656
code: message.code,
1657-
unused: message.unused,
1657+
reportsUnused: message.unused,
16581658
};
16591659
}
16601660

src/compiler/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4061,7 +4061,7 @@ namespace ts {
40614061
messageText: string | DiagnosticMessageChain;
40624062
category: DiagnosticCategory;
40634063
/** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
4064-
unused?: {};
4064+
reportsUnused?: {};
40654065
code: number;
40664066
source?: string;
40674067
}

tests/baselines/reference/api/tsserverlibrary.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,7 @@ declare namespace ts {
22792279
messageText: string | DiagnosticMessageChain;
22802280
category: DiagnosticCategory;
22812281
/** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
2282-
unused?: {};
2282+
reportsUnused?: {};
22832283
code: number;
22842284
source?: string;
22852285
}

tests/baselines/reference/api/typescript.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,7 @@ declare namespace ts {
22792279
messageText: string | DiagnosticMessageChain;
22802280
category: DiagnosticCategory;
22812281
/** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
2282-
unused?: {};
2282+
reportsUnused?: {};
22832283
code: number;
22842284
source?: string;
22852285
}

0 commit comments

Comments
 (0)