File tree 1 file changed +7
-13
lines changed
packages/angular_devkit/build_optimizer/src/helpers
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 {
31
31
32
32
function validateDiagnostics ( diagnostics : ReadonlyArray < ts . Diagnostic > , strict ?: boolean ) : boolean {
33
33
// 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
- } ;
46
34
47
35
const hasError = diagnostics . some ( diag => diag . category === ts . DiagnosticCategory . Error ) ;
48
36
if ( hasError ) {
49
37
// Throw only if we're in strict mode, otherwise return original content.
50
38
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
+
51
45
throw new Error ( `
52
46
TS failed with the following error messages:
53
47
54
- ${ checkDiagnostics ( diagnostics ) }
48
+ ${ errorMessages }
55
49
` ) ;
56
50
} else {
57
51
return false ;
You can’t perform that action at this time.
0 commit comments