mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Address PR feedback: expand ternary return into if block, add check to ensure proper options usage
This commit is contained in:
@@ -1670,6 +1670,10 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.declaration && options.declarationDir) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration"));
|
||||
}
|
||||
|
||||
const languageVersion = options.target || ScriptTarget.ES3;
|
||||
const outFile = options.outFile || options.out;
|
||||
|
||||
|
||||
@@ -2015,11 +2015,13 @@ namespace ts {
|
||||
export function getDeclarationEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost) {
|
||||
const options = host.getCompilerOptions();
|
||||
const outputDir = options.declarationDir || options.outDir; // Prefer declaration folder if specified
|
||||
return options.declaration ? removeFileExtension(
|
||||
outputDir
|
||||
|
||||
if (options.declaration) {
|
||||
const path = outputDir
|
||||
? getSourceFilePathInNewDir(sourceFile, host, outputDir)
|
||||
: sourceFile.fileName
|
||||
) + ".d.ts" : undefined;
|
||||
: sourceFile.fileName;
|
||||
return removeFileExtension(path) + ".d.ts";
|
||||
}
|
||||
}
|
||||
|
||||
export function getEmitScriptTarget(compilerOptions: CompilerOptions) {
|
||||
|
||||
Reference in New Issue
Block a user