report pre-emit diagnostics that blocked emit

This commit is contained in:
vladima 2015-12-21 21:43:51 -08:00
parent 7785e84926
commit 39605fe5f8
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;
}