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 <max.heiber@gmail.com>
This commit is contained in:
Max Heiber 2019-04-25 23:31:03 +01:00 committed by Ryan Cavanaugh
parent 5b79b942e8
commit f9d12ed54b
5 changed files with 11 additions and 13 deletions

View File

@ -2707,10 +2707,6 @@ namespace ts {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules");
}
if (options.noEmitOnError) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules");
}
if (options.out) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
}

View File

@ -1,6 +1,7 @@
error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
tests/cases/compiler/file1.ts(1,14): error TS2322: Type '3' is not assignable to type 'string'.
!!! error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.
==== tests/cases/compiler/file1.ts (0 errors) ====
export var x;
==== tests/cases/compiler/file1.ts (1 errors) ====
export const x: string = 3;
~
!!! error TS2322: Type '3' is not assignable to type 'string'.

View File

@ -1,4 +1,4 @@
=== tests/cases/compiler/file1.ts ===
export var x;
>x : Symbol(x, Decl(file1.ts, 0, 10))
export const x: string = 3;
>x : Symbol(x, Decl(file1.ts, 0, 12))

View File

@ -1,4 +1,5 @@
=== tests/cases/compiler/file1.ts ===
export var x;
>x : any
export const x: string = 3;
>x : string
>3 : 3

View File

@ -3,4 +3,4 @@
// @target: es6
// @filename: file1.ts
export var x;
export const x: string = 3;