diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 72a4e44c78d..41cd0d5c413 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2987,7 +2987,7 @@ 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)) { + if (!options.listFilesOnly && options.noEmit && isIncrementalCompilation(options)) { createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", options.incremental ? "incremental" : "composite"); } diff --git a/tests/baselines/reference/noEmitAndCompositeListFilesOnly.symbols b/tests/baselines/reference/noEmitAndCompositeListFilesOnly.symbols new file mode 100644 index 00000000000..05c35bcf58a --- /dev/null +++ b/tests/baselines/reference/noEmitAndCompositeListFilesOnly.symbols @@ -0,0 +1,4 @@ +=== /a.ts === +const x = 10; +>x : Symbol(x, Decl(a.ts, 0, 5)) + diff --git a/tests/baselines/reference/noEmitAndCompositeListFilesOnly.types b/tests/baselines/reference/noEmitAndCompositeListFilesOnly.types new file mode 100644 index 00000000000..ed892fed2ba --- /dev/null +++ b/tests/baselines/reference/noEmitAndCompositeListFilesOnly.types @@ -0,0 +1,5 @@ +=== /a.ts === +const x = 10; +>x : 10 +>10 : 10 + diff --git a/tests/baselines/reference/noEmitAndIncrementalListFilesOnly.symbols b/tests/baselines/reference/noEmitAndIncrementalListFilesOnly.symbols new file mode 100644 index 00000000000..05c35bcf58a --- /dev/null +++ b/tests/baselines/reference/noEmitAndIncrementalListFilesOnly.symbols @@ -0,0 +1,4 @@ +=== /a.ts === +const x = 10; +>x : Symbol(x, Decl(a.ts, 0, 5)) + diff --git a/tests/baselines/reference/noEmitAndIncrementalListFilesOnly.types b/tests/baselines/reference/noEmitAndIncrementalListFilesOnly.types new file mode 100644 index 00000000000..ed892fed2ba --- /dev/null +++ b/tests/baselines/reference/noEmitAndIncrementalListFilesOnly.types @@ -0,0 +1,5 @@ +=== /a.ts === +const x = 10; +>x : 10 +>10 : 10 + diff --git a/tests/cases/compiler/noEmitAndCompositeListFilesOnly.ts b/tests/cases/compiler/noEmitAndCompositeListFilesOnly.ts new file mode 100644 index 00000000000..381c2ea6506 --- /dev/null +++ b/tests/cases/compiler/noEmitAndCompositeListFilesOnly.ts @@ -0,0 +1,12 @@ +// @listFilesOnly: true + +// @Filename: /a.ts +const x = 10; + +// @Filename: /tsconfig.json +{ + "compilerOptions": { + "noEmit": true, + "composite": true + } +} diff --git a/tests/cases/compiler/noEmitAndIncrementalListFilesOnly.ts b/tests/cases/compiler/noEmitAndIncrementalListFilesOnly.ts new file mode 100644 index 00000000000..a0382538283 --- /dev/null +++ b/tests/cases/compiler/noEmitAndIncrementalListFilesOnly.ts @@ -0,0 +1,13 @@ +// @listFilesOnly: true + +// @Filename: /a.ts +const x = 10; + +// @Filename: /tsconfig.json +{ + "compilerOptions": { + "noEmit": true, + "incremental": true + } +} +