mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add a code fixer for --isolatedDeclarations errors (#58260)
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
This commit is contained in:
co-authored by
Andrew Branch
parent
749bd834be
commit
33b156147b
@@ -18,6 +18,7 @@ import {
|
||||
DiagnosticWithLocation,
|
||||
FileTextChanges,
|
||||
flatMap,
|
||||
getEmitDeclarations,
|
||||
isString,
|
||||
map,
|
||||
TextChange,
|
||||
@@ -124,9 +125,15 @@ export function eachDiagnostic(context: CodeFixAllContext, errorCodes: readonly
|
||||
}
|
||||
|
||||
function getDiagnostics({ program, sourceFile, cancellationToken }: CodeFixContextBase) {
|
||||
return [
|
||||
const diagnostics = [
|
||||
...program.getSemanticDiagnostics(sourceFile, cancellationToken),
|
||||
...program.getSyntacticDiagnostics(sourceFile, cancellationToken),
|
||||
...computeSuggestionDiagnostics(sourceFile, program, cancellationToken),
|
||||
];
|
||||
if (getEmitDeclarations(program.getCompilerOptions())) {
|
||||
diagnostics.push(
|
||||
...program.getDeclarationDiagnostics(sourceFile, cancellationToken),
|
||||
);
|
||||
}
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user