Merge pull request #32887 from microsoft/incrementalNoEmit

Disallow incremental with noEmit
This commit is contained in:
Sheetal Nandi 2019-08-14 10:06:11 -07:00 committed by GitHub
commit 2483803398
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 0 deletions

View File

@ -2850,6 +2850,10 @@ namespace ts {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
}
if (options.noEmit && isIncrementalCompilation(options)) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", options.incremental ? "incremental" : "composite");
}
verifyProjectReferences();
// List of collected files is complete; validate exhautiveness if this is a project with a file list

View File

@ -0,0 +1,19 @@
/tsconfig.json(3,9): error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
/tsconfig.json(4,9): error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
==== /tsconfig.json (2 errors) ====
{
"compilerOptions": {
"noEmit": true,
~~~~~~~~
!!! error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
"composite": true
~~~~~~~~~~~
!!! error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
}
}
==== /a.ts (0 errors) ====
const x = 10;

View File

@ -0,0 +1,4 @@
=== /a.ts ===
const x = 10;
>x : Symbol(x, Decl(a.ts, 0, 5))

View File

@ -0,0 +1,5 @@
=== /a.ts ===
const x = 10;
>x : 10
>10 : 10

View File

@ -0,0 +1,20 @@
/tsconfig.json(3,9): error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
/tsconfig.json(4,9): error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
==== /tsconfig.json (2 errors) ====
{
"compilerOptions": {
"noEmit": true,
~~~~~~~~
!!! error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
"incremental": true
~~~~~~~~~~~~~
!!! error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
}
}
==== /a.ts (0 errors) ====
const x = 10;

View File

@ -0,0 +1,4 @@
=== /a.ts ===
const x = 10;
>x : Symbol(x, Decl(a.ts, 0, 5))

View File

@ -0,0 +1,5 @@
=== /a.ts ===
const x = 10;
>x : 10
>10 : 10

View File

@ -0,0 +1,10 @@
// @Filename: /a.ts
const x = 10;
// @Filename: /tsconfig.json
{
"compilerOptions": {
"noEmit": true,
"composite": true
}
}

View File

@ -0,0 +1,11 @@
// @Filename: /a.ts
const x = 10;
// @Filename: /tsconfig.json
{
"compilerOptions": {
"noEmit": true,
"incremental": true
}
}