Skip to content

Commit

Permalink
fix cli crash when checking baseline file if there are no files
Browse files Browse the repository at this point in the history
  • Loading branch information
DetachHead committed Sep 22, 2024
1 parent 8be1739 commit 98122f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/pyright-internal/src/pyright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ const outputResults = (
// --writebaseline
if (
args.writebaseline ||
!filteredDiagnostics.map((fileWithDiagnostics) => fileWithDiagnostics.diagnostics.length).reduce(add)
!filteredDiagnostics.map((fileWithDiagnostics) => fileWithDiagnostics.diagnostics.length).reduce(add, 0)
) {
const previousBaseline = getBaselinedErrors(service.fs, rootDir);
const newBaseline = writeDiagnosticsToBaselineFile(service.fs, rootDir, results.diagnostics, false);
Expand Down

0 comments on commit 98122f0

Please sign in to comment.