mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Remove errors if noEmit is sepcified with noCheck or emitDeclarationOnly (#59071)
This commit is contained in:
@@ -4438,16 +4438,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 (
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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!";
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.
|
||||
error TS5053: Option 'noCheck' cannot be specified with option 'noEmit'.
|
||||
|
||||
|
||||
!!! error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.
|
||||
!!! error TS5053: Option 'noCheck' cannot be specified with option 'noEmit'.
|
||||
==== noCheckNoEmit.ts (0 errors) ====
|
||||
export const a: number = "not ok";
|
||||
|
||||
Reference in New Issue
Block a user