Skip to content

Remove errors if noEmit is sepcified with noCheck or emitDeclarationOnly #59071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4437,16 +4437,6 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
if (!getEmitDeclarations(options)) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "emitDeclarationOnly", "declaration", "composite");
}

if (options.noEmit) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit");
}
}

if (options.noCheck) {
if (options.noEmit) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
}
}

if (
Expand Down
2 changes: 1 addition & 1 deletion src/harness/harnessIO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ export namespace Compiler {
): DeclarationCompilationContext | undefined {
if (options.declaration && result.diagnostics.length === 0) {
if (options.emitDeclarationOnly) {
if (result.js.size > 0 || result.dts.size === 0) {
if (result.js.size > 0 || (result.dts.size === 0 && !options.noEmit)) {
throw new Error("Only declaration files should be generated when emitDeclarationOnly:true");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.
error TS5069: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declaration' or option 'composite'.


!!! error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.
!!! error TS5069: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declaration' or option 'composite'.
==== hello.ts (0 errors) ====
var hello = "yo!";
Expand Down
9 changes: 0 additions & 9 deletions tests/baselines/reference/noCheckNoEmit.errors.txt

This file was deleted.