Merge pull request #6200 from Microsoft/reportPreEmitDiagnostics

report pre-emit diagnostics that blocked emit
This commit is contained in:
Vladimir Matveev 2015-12-22 09:20:31 -08:00
commit 827fec6cf3
3 changed files with 24 additions and 2 deletions

View File

@ -573,8 +573,11 @@ namespace ts {
// If the noEmitOnError flag is set, then check if we have any errors so far. If so,
// immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we
// get any preEmit diagnostics, not just the ones
if (options.noEmitOnError && getPreEmitDiagnostics(program, /*sourceFile:*/ undefined, cancellationToken).length > 0) {
return { diagnostics: [], sourceMaps: undefined, emitSkipped: true };
if (options.noEmitOnError) {
const preEmitDiagnostics = getPreEmitDiagnostics(program, /*sourceFile:*/ undefined, cancellationToken);
if (preEmitDiagnostics.length > 0) {
return { diagnostics: preEmitDiagnostics, sourceMaps: undefined, emitSkipped: true };
}
}
// Create the emit resolver outside of the "emitTime" tracking code below. That way

View File

@ -0,0 +1,11 @@
tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts(4,8): error TS4033: Property 'f' of exported interface has or is using private name 'T'.
==== tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts (1 errors) ====
type T = { x : number }
export interface I {
f: T;
~
!!! error TS4033: Property 'f' of exported interface has or is using private name 'T'.
}

View File

@ -0,0 +1,8 @@
// @module: commonjs
// @declaration: true
// @noEmitOnError: true
type T = { x : number }
export interface I {
f: T;
}