Skip to content

Commit cb98634

Browse files
authored
Remove errors if noEmit is sepcified with noCheck or emitDeclarationOnly (#59071)
1 parent 6c68fdd commit cb98634

File tree

4 files changed

+1
-22
lines changed

4 files changed

+1
-22
lines changed

src/compiler/program.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4438,16 +4438,6 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
44384438
if (!getEmitDeclarations(options)) {
44394439
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "emitDeclarationOnly", "declaration", "composite");
44404440
}
4441-
4442-
if (options.noEmit) {
4443-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit");
4444-
}
4445-
}
4446-
4447-
if (options.noCheck) {
4448-
if (options.noEmit) {
4449-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
4450-
}
44514441
}
44524442

44534443
if (

src/harness/harnessIO.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ export namespace Compiler {
453453
): DeclarationCompilationContext | undefined {
454454
if (options.declaration && result.diagnostics.length === 0) {
455455
if (options.emitDeclarationOnly) {
456-
if (result.js.size > 0 || result.dts.size === 0) {
456+
if (result.js.size > 0 || (result.dts.size === 0 && !options.noEmit)) {
457457
throw new Error("Only declaration files should be generated when emitDeclarationOnly:true");
458458
}
459459
}

tests/baselines/reference/declFileEmitDeclarationOnlyError2.errors.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.
21
error TS5069: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declaration' or option 'composite'.
32

43

5-
!!! error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.
64
!!! error TS5069: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declaration' or option 'composite'.
75
==== hello.ts (0 errors) ====
86
var hello = "yo!";

tests/baselines/reference/noCheckNoEmit.errors.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)