File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed
packages/angular_devkit/build_optimizer/src/helpers Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -31,27 +31,21 @@ interface DiagnosticSourceFile extends ts.SourceFile {
3131
3232function validateDiagnostics ( diagnostics : ReadonlyArray < ts . Diagnostic > , strict ?: boolean ) : boolean {
3333 // Print error diagnostics.
34- const checkDiagnostics = ( diagnostics : ReadonlyArray < ts . Diagnostic > ) => {
35- if ( diagnostics && diagnostics . length > 0 ) {
36- let errors = '' ;
37- errors = errors + '\n' + ts . formatDiagnostics ( diagnostics , {
38- getCurrentDirectory : ( ) => ts . sys . getCurrentDirectory ( ) ,
39- getNewLine : ( ) => ts . sys . newLine ,
40- getCanonicalFileName : ( f : string ) => f ,
41- } ) ;
42-
43- return errors ;
44- }
45- } ;
4634
4735 const hasError = diagnostics . some ( diag => diag . category === ts . DiagnosticCategory . Error ) ;
4836 if ( hasError ) {
4937 // Throw only if we're in strict mode, otherwise return original content.
5038 if ( strict ) {
39+ const errorMessages = ts . formatDiagnostics ( diagnostics , {
40+ getCurrentDirectory : ( ) => ts . sys . getCurrentDirectory ( ) ,
41+ getNewLine : ( ) => ts . sys . newLine ,
42+ getCanonicalFileName : ( f : string ) => f ,
43+ } ) ;
44+
5145 throw new Error ( `
5246 TS failed with the following error messages:
5347
54- ${ checkDiagnostics ( diagnostics ) }
48+ ${ errorMessages }
5549 ` ) ;
5650 } else {
5751 return false ;
You can’t perform that action at this time.
0 commit comments