Skip to content

Commit 0bcc46a

Browse files
committed
Ensure --pretty with --build is passed correctly to create reporters
Fixes #30282
1 parent 84087d0 commit 0bcc46a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/tsc/tsc.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace ts {
1313
}
1414

1515
let reportDiagnostic = createDiagnosticReporter(sys);
16-
function updateReportDiagnostic(options?: CompilerOptions) {
16+
function updateReportDiagnostic(options: CompilerOptions | BuildOptions) {
1717
if (shouldBePretty(options)) {
1818
reportDiagnostic = createDiagnosticReporter(sys, /*pretty*/ true);
1919
}
@@ -23,7 +23,7 @@ namespace ts {
2323
return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY();
2424
}
2525

26-
function shouldBePretty(options?: CompilerOptions) {
26+
function shouldBePretty(options: CompilerOptions | BuildOptions) {
2727
if (!options || typeof options.pretty === "undefined") {
2828
return defaultIsPretty();
2929
}
@@ -192,7 +192,7 @@ namespace ts {
192192
}
193193

194194
// Update to pretty if host supports it
195-
updateReportDiagnostic();
195+
updateReportDiagnostic(buildOptions);
196196
if (projects.length === 0) {
197197
printVersion();
198198
printHelp(buildOpts, "--build ");
@@ -209,8 +209,8 @@ namespace ts {
209209

210210
// Use default createProgram
211211
const buildHost = buildOptions.watch ?
212-
createSolutionBuilderWithWatchHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty()), createWatchStatusReporter()) :
213-
createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty()), createReportErrorSummary(buildOptions));
212+
createSolutionBuilderWithWatchHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createWatchStatusReporter(buildOptions)) :
213+
createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createReportErrorSummary(buildOptions));
214214
updateCreateProgram(buildHost);
215215
buildHost.afterProgramEmitAndDiagnostics = (program: BuilderProgram) => reportStatistics(program.getProgram());
216216

@@ -316,7 +316,7 @@ namespace ts {
316316
};
317317
}
318318

319-
function createWatchStatusReporter(options?: CompilerOptions) {
319+
function createWatchStatusReporter(options: CompilerOptions | BuildOptions) {
320320
return ts.createWatchStatusReporter(sys, shouldBePretty(options));
321321
}
322322

0 commit comments

Comments
 (0)