Rename switch --emitDeclarationsOnly
to --emitDeclarationOnly
(#21651)
* Rename `--emitDeclarationsOnly` to `--renameDeclarationOnly` * Rename test files
This commit is contained in:
parent
c7b86e824f
commit
8f8fec433e
|
@ -187,7 +187,7 @@ namespace ts {
|
|||
description: Diagnostics.Generates_corresponding_d_ts_file,
|
||||
},
|
||||
{
|
||||
name: "emitDeclarationsOnly",
|
||||
name: "emitDeclarationOnly",
|
||||
type: "boolean",
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Only_emit_d_ts_declaration_files,
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace ts {
|
|||
|
||||
function emitSourceFileOrBundle({ jsFilePath, sourceMapFilePath, declarationFilePath }: EmitFileNames, sourceFileOrBundle: SourceFile | Bundle) {
|
||||
// Make sure not to write js file and source map file if any of them cannot be written
|
||||
if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit && !compilerOptions.emitDeclarationsOnly) {
|
||||
if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit && !compilerOptions.emitDeclarationOnly) {
|
||||
if (!emitOnlyDtsFiles) {
|
||||
printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle);
|
||||
}
|
||||
|
|
|
@ -2201,13 +2201,13 @@ namespace ts {
|
|||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs"));
|
||||
}
|
||||
|
||||
if (options.emitDeclarationsOnly) {
|
||||
if (options.emitDeclarationOnly) {
|
||||
if (!options.declaration) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDeclarationsOnly", "declarations");
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDeclarationOnly", "declarations");
|
||||
}
|
||||
|
||||
if (options.noEmit) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationsOnly", "noEmit");
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2233,7 +2233,7 @@ namespace ts {
|
|||
const emitHost = getEmitHost();
|
||||
const emitFilesSeen = createMap<true>();
|
||||
forEachEmittedFile(emitHost, (emitFileNames) => {
|
||||
if (!options.emitDeclarationsOnly) {
|
||||
if (!options.emitDeclarationOnly) {
|
||||
verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen);
|
||||
}
|
||||
verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen);
|
||||
|
|
|
@ -4025,7 +4025,7 @@ namespace ts {
|
|||
/** configFile is set as non enumerable property so as to avoid checking of json source files */
|
||||
/* @internal */ readonly configFile?: JsonSourceFile;
|
||||
declaration?: boolean;
|
||||
emitDeclarationsOnly?: boolean;
|
||||
emitDeclarationOnly?: boolean;
|
||||
declarationDir?: string;
|
||||
/* @internal */ diagnostics?: boolean;
|
||||
/* @internal */ extendedDiagnostics?: boolean;
|
||||
|
|
|
@ -1255,9 +1255,9 @@ namespace Harness {
|
|||
|
||||
if (result.errors.length === 0) {
|
||||
if (options.declaration) {
|
||||
if (options.emitDeclarationsOnly) {
|
||||
if (options.emitDeclarationOnly) {
|
||||
if (result.files.length > 0 || result.declFilesCode.length === 0) {
|
||||
throw new Error("Only declaration files should be generated when emitDeclarationsOnly:true");
|
||||
throw new Error("Only declaration files should be generated when emitDeclarationOnly:true");
|
||||
}
|
||||
}
|
||||
else if (result.declFilesCode.length !== result.files.length) {
|
||||
|
@ -1664,7 +1664,7 @@ namespace Harness {
|
|||
}
|
||||
|
||||
export function doJsEmitBaseline(baselinePath: string, header: string, options: ts.CompilerOptions, result: CompilerResult, tsConfigFiles: Harness.Compiler.TestFile[], toBeCompiled: Harness.Compiler.TestFile[], otherFiles: Harness.Compiler.TestFile[], harnessSettings: Harness.TestCaseParser.CompilerSettings) {
|
||||
if (!options.noEmit && !options.emitDeclarationsOnly && result.files.length === 0 && result.errors.length === 0) {
|
||||
if (!options.noEmit && !options.emitDeclarationOnly && result.files.length === 0 && result.errors.length === 0) {
|
||||
throw new Error("Expected at least one js file to be emitted or at least one error to be created.");
|
||||
}
|
||||
|
||||
|
|
|
@ -2301,7 +2301,7 @@ declare namespace ts {
|
|||
charset?: string;
|
||||
checkJs?: boolean;
|
||||
declaration?: boolean;
|
||||
emitDeclarationsOnly?: boolean;
|
||||
emitDeclarationOnly?: boolean;
|
||||
declarationDir?: string;
|
||||
disableSizeLimit?: boolean;
|
||||
downlevelIteration?: boolean;
|
||||
|
|
|
@ -2301,7 +2301,7 @@ declare namespace ts {
|
|||
charset?: string;
|
||||
checkJs?: boolean;
|
||||
declaration?: boolean;
|
||||
emitDeclarationsOnly?: boolean;
|
||||
emitDeclarationOnly?: boolean;
|
||||
declarationDir?: string;
|
||||
disableSizeLimit?: boolean;
|
||||
downlevelIteration?: boolean;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
error TS5052: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declarations'.
|
||||
|
||||
|
||||
!!! error TS5052: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declarations'.
|
||||
==== tests/cases/compiler/hello.ts (0 errors) ====
|
||||
var hello = "yo!";
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
error TS5052: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declarations'.
|
||||
error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.
|
||||
|
||||
|
||||
!!! error TS5052: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declarations'.
|
||||
!!! error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.
|
||||
==== tests/cases/compiler/hello.ts (0 errors) ====
|
||||
var hello = "yo!";
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
error TS5052: Option 'emitDeclarationsOnly' cannot be specified without specifying option 'declarations'.
|
||||
|
||||
|
||||
!!! error TS5052: Option 'emitDeclarationsOnly' cannot be specified without specifying option 'declarations'.
|
||||
==== tests/cases/compiler/hello.ts (0 errors) ====
|
||||
var hello = "yo!";
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
error TS5052: Option 'emitDeclarationsOnly' cannot be specified without specifying option 'declarations'.
|
||||
error TS5053: Option 'emitDeclarationsOnly' cannot be specified with option 'noEmit'.
|
||||
|
||||
|
||||
!!! error TS5052: Option 'emitDeclarationsOnly' cannot be specified without specifying option 'declarations'.
|
||||
!!! error TS5053: Option 'emitDeclarationsOnly' cannot be specified with option 'noEmit'.
|
||||
==== tests/cases/compiler/hello.ts (0 errors) ====
|
||||
var hello = "yo!";
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// @declaration: true
|
||||
// @emitDeclarationsOnly: true
|
||||
// @emitDeclarationOnly: true
|
||||
|
||||
// @filename: helloworld.ts
|
||||
const Log = {
|
|
@ -1,4 +1,4 @@
|
|||
// @emitDeclarationsOnly: true
|
||||
// @emitDeclarationOnly: true
|
||||
|
||||
// @filename: hello.ts
|
||||
var hello = "yo!";
|
|
@ -1,5 +1,5 @@
|
|||
// @noEmit: true
|
||||
// @emitDeclarationsOnly: true
|
||||
// @emitDeclarationOnly: true
|
||||
|
||||
// @filename: hello.ts
|
||||
var hello = "yo!";
|
Loading…
Reference in a new issue