Skip to content

Commit f9d12ed

Browse files
mheiberRyanCavanaugh
authored andcommitted
fix 31012 allow noEmitOnError with isolatedModules (#34) (#31043)
fix #31012 Since the purpose of isolatedModules: true is to do extra validation to ensure that separate compilation is safe Allowing emit in the presence of errors is compatible with that intention. Signed-off-by: Max Heiber <[email protected]>
1 parent 5b79b94 commit f9d12ed

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

src/compiler/program.ts

-4
Original file line numberDiff line numberDiff line change
@@ -2707,10 +2707,6 @@ namespace ts {
27072707
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules");
27082708
}
27092709

2710-
if (options.noEmitOnError) {
2711-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules");
2712-
}
2713-
27142710
if (options.out) {
27152711
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
27162712
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
1+
tests/cases/compiler/file1.ts(1,14): error TS2322: Type '3' is not assignable to type 'string'.
22

33

4-
!!! error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
5-
==== tests/cases/compiler/file1.ts (0 errors) ====
6-
export var x;
4+
==== tests/cases/compiler/file1.ts (1 errors) ====
5+
export const x: string = 3;
6+
~
7+
!!! error TS2322: Type '3' is not assignable to type 'string'.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
=== tests/cases/compiler/file1.ts ===
2-
export var x;
3-
>x : Symbol(x, Decl(file1.ts, 0, 10))
2+
export const x: string = 3;
3+
>x : Symbol(x, Decl(file1.ts, 0, 12))
44

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
=== tests/cases/compiler/file1.ts ===
2-
export var x;
3-
>x : any
2+
export const x: string = 3;
3+
>x : string
4+
>3 : 3
45

tests/cases/compiler/isolatedModulesNoEmitOnError.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// @target: es6
44

55
// @filename: file1.ts
6-
export var x;
6+
export const x: string = 3;

0 commit comments

Comments
 (0)