@@ -61,23 +61,16 @@ export class ProjectCompiler implements ICompiler {
6161 ) ;
6262
6363 this . program = this . project . typescript . createProgram ( rootFilenames , this . project . options , this . host , this . program ) ;
64- const preEmitDiagnostics = this . project . typescript . getPreEmitDiagnostics ( this . program ) ;
65-
64+
6665 const result = emptyCompilationResult ( ) ;
67- result . optionsErrors = this . program . getOptionsDiagnostics ( ) . length ;
68- result . syntaxErrors = this . program . getSyntacticDiagnostics ( ) . length ;
69- result . globalErrors = this . program . getGlobalDiagnostics ( ) . length ;
70- result . semanticErrors = this . program . getSemanticDiagnostics ( ) . length ;
66+ result . optionsErrors = this . reportDiagnostics ( this . program . getOptionsDiagnostics ( ) ) ;
67+ result . syntaxErrors = this . reportDiagnostics ( this . program . getSyntacticDiagnostics ( ) ) ;
68+ result . globalErrors = this . reportDiagnostics ( this . program . getGlobalDiagnostics ( ) ) ;
69+ result . semanticErrors = this . reportDiagnostics ( this . program . getSemanticDiagnostics ( ) ) ;
7170 if ( this . project . options . declaration ) {
7271 result . declarationErrors = this . program . getDeclarationDiagnostics ( ) . length ;
7372 }
7473
75- this . reportDiagnostics ( preEmitDiagnostics ) ;
76-
77- const emitOutput = this . program . emit ( ) ;
78- result . emitErrors = emitOutput . diagnostics . length ;
79- result . emitSkipped = emitOutput . emitSkipped ;
80-
8174 if ( this . project . singleOutput ) {
8275 this . emitFile ( result , currentDirectory ) ;
8376 } else {
@@ -163,6 +156,7 @@ export class ProjectCompiler implements ICompiler {
163156 for ( const error of diagnostics ) {
164157 this . project . output . diagnostic ( error ) ;
165158 }
159+ return diagnostics . length ;
166160 }
167161
168162 private removeSourceMapComment ( content : string ) : string {
0 commit comments