@@ -36,12 +36,12 @@ namespace ts {
3636 return declarationDiagnostics . getDiagnostics ( targetSourceFile ? targetSourceFile . fileName : undefined ) ;
3737
3838 function getDeclarationDiagnosticsFromFile ( { declarationFilePath } : EmitFileNames , sources : SourceFile [ ] , isBundledEmit : boolean ) {
39- emitDeclarations ( host , resolver , declarationDiagnostics , declarationFilePath , sources , isBundledEmit ) ;
39+ emitDeclarations ( host , resolver , declarationDiagnostics , declarationFilePath , sources , isBundledEmit , /*emitOnlyDtsFiles*/ false ) ;
4040 }
4141 }
4242
4343 function emitDeclarations ( host : EmitHost , resolver : EmitResolver , emitterDiagnostics : DiagnosticCollection , declarationFilePath : string ,
44- sourceFiles : SourceFile [ ] , isBundledEmit : boolean ) : DeclarationEmit {
44+ sourceFiles : SourceFile [ ] , isBundledEmit : boolean , emitOnlyDtsFiles : boolean ) : DeclarationEmit {
4545 const newLine = host . getNewLine ( ) ;
4646 const compilerOptions = host . getCompilerOptions ( ) ;
4747
@@ -98,7 +98,7 @@ namespace ts {
9898 // global file reference is added only
9999 // - if it is not bundled emit (because otherwise it would be self reference)
100100 // - and it is not already added
101- if ( writeReferencePath ( referencedFile , ! isBundledEmit && ! addedGlobalFileReference ) ) {
101+ if ( writeReferencePath ( referencedFile , ! isBundledEmit && ! addedGlobalFileReference , emitOnlyDtsFiles ) ) {
102102 addedGlobalFileReference = true ;
103103 }
104104 emittedReferencedFiles . push ( referencedFile ) ;
@@ -1713,7 +1713,7 @@ namespace ts {
17131713 * @param referencedFile
17141714 * @param addBundledFileReference Determines if global file reference corresponding to bundled file should be emitted or not
17151715 */
1716- function writeReferencePath ( referencedFile : SourceFile , addBundledFileReference : boolean ) : boolean {
1716+ function writeReferencePath ( referencedFile : SourceFile , addBundledFileReference : boolean , emitOnlyDtsFiles : boolean ) : boolean {
17171717 let declFileName : string ;
17181718 let addedBundledEmitReference = false ;
17191719 if ( isDeclarationFile ( referencedFile ) ) {
@@ -1722,7 +1722,7 @@ namespace ts {
17221722 }
17231723 else {
17241724 // Get the declaration file path
1725- forEachExpectedEmitFile ( host , getDeclFileName , referencedFile ) ;
1725+ forEachExpectedEmitFile ( host , getDeclFileName , referencedFile , emitOnlyDtsFiles ) ;
17261726 }
17271727
17281728 if ( declFileName ) {
@@ -1751,8 +1751,8 @@ namespace ts {
17511751 }
17521752
17531753 /* @internal */
1754- export function writeDeclarationFile ( declarationFilePath : string , sourceFiles : SourceFile [ ] , isBundledEmit : boolean , host : EmitHost , resolver : EmitResolver , emitterDiagnostics : DiagnosticCollection ) {
1755- const emitDeclarationResult = emitDeclarations ( host , resolver , emitterDiagnostics , declarationFilePath , sourceFiles , isBundledEmit ) ;
1754+ export function writeDeclarationFile ( declarationFilePath : string , sourceFiles : SourceFile [ ] , isBundledEmit : boolean , host : EmitHost , resolver : EmitResolver , emitterDiagnostics : DiagnosticCollection , emitOnlyDtsFiles : boolean ) {
1755+ const emitDeclarationResult = emitDeclarations ( host , resolver , emitterDiagnostics , declarationFilePath , sourceFiles , isBundledEmit , emitOnlyDtsFiles ) ;
17561756 const emitSkipped = emitDeclarationResult . reportedDeclarationError || host . isEmitBlocked ( declarationFilePath ) || host . getCompilerOptions ( ) . noEmit ;
17571757 if ( ! emitSkipped ) {
17581758 const declarationOutput = emitDeclarationResult . referencesOutput
0 commit comments