Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0e9416c

Browse filesBrowse files
authored
Disallow incremental with noEmit (microsoft#36483)
Fixes microsoft#32882
1 parent f91f762 commit 0e9416c
Copy full SHA for 0e9416c
Expand file treeCollapse file tree

9 files changed

+82
-0
lines changed

‎src/compiler/program.ts

Copy file name to clipboardExpand all lines: src/compiler/program.ts
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,6 +2987,10 @@ namespace ts {
29872987
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
29882988
}
29892989

2990+
if (options.noEmit && isIncrementalCompilation(options)) {
2991+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", options.incremental ? "incremental" : "composite");
2992+
}
2993+
29902994
verifyProjectReferences();
29912995

29922996
// List of collected files is complete; validate exhautiveness if this is a project with a file list
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/tsconfig.json(3,9): error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
2+
/tsconfig.json(4,9): error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
3+
4+
5+
==== /tsconfig.json (2 errors) ====
6+
{
7+
"compilerOptions": {
8+
"noEmit": true,
9+
~~~~~~~~
10+
!!! error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
11+
"composite": true
12+
~~~~~~~~~~~
13+
!!! error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
14+
}
15+
}
16+
17+
==== /a.ts (0 errors) ====
18+
const x = 10;
19+
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
=== /a.ts ===
2+
const x = 10;
3+
>x : Symbol(x, Decl(a.ts, 0, 5))
4+
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
=== /a.ts ===
2+
const x = 10;
3+
>x : 10
4+
>10 : 10
5+
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/tsconfig.json(3,9): error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
2+
/tsconfig.json(4,9): error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
3+
4+
5+
==== /tsconfig.json (2 errors) ====
6+
{
7+
"compilerOptions": {
8+
"noEmit": true,
9+
~~~~~~~~
10+
!!! error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
11+
"incremental": true
12+
~~~~~~~~~~~~~
13+
!!! error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
14+
}
15+
}
16+
17+
18+
==== /a.ts (0 errors) ====
19+
const x = 10;
20+
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
=== /a.ts ===
2+
const x = 10;
3+
>x : Symbol(x, Decl(a.ts, 0, 5))
4+
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
=== /a.ts ===
2+
const x = 10;
3+
>x : 10
4+
>10 : 10
5+
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @Filename: /a.ts
2+
const x = 10;
3+
4+
// @Filename: /tsconfig.json
5+
{
6+
"compilerOptions": {
7+
"noEmit": true,
8+
"composite": true
9+
}
10+
}
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @Filename: /a.ts
2+
const x = 10;
3+
4+
// @Filename: /tsconfig.json
5+
{
6+
"compilerOptions": {
7+
"noEmit": true,
8+
"incremental": true
9+
}
10+
}
11+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.