Skip to content

Commit eb7d809

Browse files
authored
Merge pull request github#3064 from asger-semmle/js/typescript-semantic-errors
Approved by erik-krogh
2 parents 5b20133 + b2f008e commit eb7d809

File tree

1 file changed

+4
-2
lines changed
  • javascript/extractor/lib/typescript/src

1 file changed

+4
-2
lines changed

javascript/extractor/lib/typescript/src/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,10 @@ function handleOpenProjectCommand(command: OpenProjectCommand) {
422422
let program = project.program;
423423
let typeChecker = program.getTypeChecker();
424424

425-
let diagnostics = program.getSemanticDiagnostics()
426-
.filter(d => d.category === ts.DiagnosticCategory.Error);
425+
let shouldReportDiagnostics = getEnvironmentVariable("SEMMLE_TYPESCRIPT_REPORT_DIAGNOSTICS", Boolean, false);
426+
let diagnostics = shouldReportDiagnostics
427+
? program.getSemanticDiagnostics().filter(d => d.category === ts.DiagnosticCategory.Error)
428+
: [];
427429
if (diagnostics.length > 0) {
428430
console.warn('TypeScript: reported ' + diagnostics.length + ' semantic errors.');
429431
}

0 commit comments

Comments
 (0)