Rename switch --emitDeclarationsOnly to --emitDeclarationOnly (#21651)

* Rename `--emitDeclarationsOnly` to `--renameDeclarationOnly`

* Rename test files
This commit is contained in:
Mohamed Hegazy 2018-02-05 14:48:50 -08:00 committed by GitHub
parent c7b86e824f
commit 8f8fec433e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 31 additions and 31 deletions

View file

@ -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,

View file

@ -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);
}

View file

@ -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);

View file

@ -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;

View file

@ -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.");
}

View file

@ -2301,7 +2301,7 @@ declare namespace ts {
charset?: string;
checkJs?: boolean;
declaration?: boolean;
emitDeclarationsOnly?: boolean;
emitDeclarationOnly?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
downlevelIteration?: boolean;

View file

@ -2301,7 +2301,7 @@ declare namespace ts {
charset?: string;
checkJs?: boolean;
declaration?: boolean;
emitDeclarationsOnly?: boolean;
emitDeclarationOnly?: boolean;
declarationDir?: string;
disableSizeLimit?: boolean;
downlevelIteration?: boolean;

View file

@ -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!";

View file

@ -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!";

View file

@ -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!";

View file

@ -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!";

View file

@ -1,5 +1,5 @@
// @declaration: true
// @emitDeclarationsOnly: true
// @emitDeclarationOnly: true
// @filename: helloworld.ts
const Log = {

View file

@ -1,4 +1,4 @@
// @emitDeclarationsOnly: true
// @emitDeclarationOnly: true
// @filename: hello.ts
var hello = "yo!";

View file

@ -1,5 +1,5 @@
// @noEmit: true
// @emitDeclarationsOnly: true
// @emitDeclarationOnly: true
// @filename: hello.ts
var hello = "yo!";