report pre-emit diagnostics that blocked emit
This commit is contained in:
parent
7785e84926
commit
39605fe5f8
|
@ -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
|
||||
|
|
|
@ -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'.
|
||||
}
|
8
tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts
Normal file
8
tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
// @module: commonjs
|
||||
// @declaration: true
|
||||
// @noEmitOnError: true
|
||||
|
||||
type T = { x : number }
|
||||
export interface I {
|
||||
f: T;
|
||||
}
|
Loading…
Reference in a new issue