Skip to content

Commit

Permalink
fix(@ngtools/webpack): use tsconfig declaration flag to report decl e…
Browse files Browse the repository at this point in the history
…rrors (#3499)
  • Loading branch information
the-destro authored and hansl committed Dec 9, 2016
1 parent 87b93e1 commit c46de15
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/@ngtools/webpack/src/refactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,20 @@ export class TypeScriptFileRefactor {
this._sourceString = new MagicString(this._sourceText);
}

/**
* Collates the diagnostic messages for the current source file
*/
getDiagnostics(): ts.Diagnostic[] {
if (!this._program) {
return [];
}

return this._program.getSyntacticDiagnostics(this._sourceFile)
.concat(this._program.getSemanticDiagnostics(this._sourceFile))
.concat(this._program.getDeclarationDiagnostics(this._sourceFile));
let diagnostics: ts.Diagnostic[] = this._program.getSyntacticDiagnostics(this._sourceFile)
.concat(this._program.getSemanticDiagnostics(this._sourceFile));
// only concat the declaration diagnostics if the tsconfig config sets it to true.
if (this._program.getCompilerOptions().declaration == true) {
diagnostics = diagnostics.concat(this._program.getDeclarationDiagnostics(this._sourceFile));
}
return diagnostics;
}

/**
Expand Down

0 comments on commit c46de15

Please sign in to comment.