File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1670,6 +1670,10 @@ namespace ts {
16701670 }
16711671 }
16721672
1673+ if ( ! options . declaration && options . declarationDir ) {
1674+ programDiagnostics . add ( createCompilerDiagnostic ( Diagnostics . Option_0_cannot_be_specified_without_specifying_option_1 , "declarationDir" , "declaration" ) ) ;
1675+ }
1676+
16731677 const languageVersion = options . target || ScriptTarget . ES3 ;
16741678 const outFile = options . outFile || options . out ;
16751679
Original file line number Diff line number Diff line change @@ -2015,11 +2015,13 @@ namespace ts {
20152015 export function getDeclarationEmitOutputFilePath ( sourceFile : SourceFile , host : EmitHost ) {
20162016 const options = host . getCompilerOptions ( ) ;
20172017 const outputDir = options . declarationDir || options . outDir ; // Prefer declaration folder if specified
2018- return options . declaration ? removeFileExtension (
2019- outputDir
2018+
2019+ if ( options . declaration ) {
2020+ const path = outputDir
20202021 ? getSourceFilePathInNewDir ( sourceFile , host , outputDir )
2021- : sourceFile . fileName
2022- ) + ".d.ts" : undefined ;
2022+ : sourceFile . fileName ;
2023+ return removeFileExtension ( path ) + ".d.ts" ;
2024+ }
20232025 }
20242026
20252027 export function getEmitScriptTarget ( compilerOptions : CompilerOptions ) {
You can’t perform that action at this time.
0 commit comments