Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 0 deletions tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @module: commonjs
// @declaration: true
// @noEmitOnError: true

type T = { x : number }
export interface I {
f: T;
}