File tree 1 file changed +10
-4
lines changed
packages/@ngtools/webpack/src
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -48,14 +48,20 @@ export class TypeScriptFileRefactor {
48
48
this . _sourceString = new MagicString ( this . _sourceText ) ;
49
49
}
50
50
51
+ /**
52
+ * Collates the diagnostic messages for the current source file
53
+ */
51
54
getDiagnostics ( ) : ts . Diagnostic [ ] {
52
55
if ( ! this . _program ) {
53
56
return [ ] ;
54
57
}
55
-
56
- return this . _program . getSyntacticDiagnostics ( this . _sourceFile )
57
- . concat ( this . _program . getSemanticDiagnostics ( this . _sourceFile ) )
58
- . concat ( this . _program . getDeclarationDiagnostics ( this . _sourceFile ) ) ;
58
+ let diagnostics : ts . Diagnostic [ ] = this . _program . getSyntacticDiagnostics ( this . _sourceFile )
59
+ . concat ( this . _program . getSemanticDiagnostics ( this . _sourceFile ) ) ;
60
+ // only concat the declaration diagnostics if the tsconfig config sets it to true.
61
+ if ( this . _program . getCompilerOptions ( ) . declaration == true ) {
62
+ diagnostics = diagnostics . concat ( this . _program . getDeclarationDiagnostics ( this . _sourceFile ) ) ;
63
+ }
64
+ return diagnostics ;
59
65
}
60
66
61
67
/**
You can’t perform that action at this time.
0 commit comments