@@ -1538,18 +1538,13 @@ namespace ts {
1538
1538
// Report error if the output overwrites input file
1539
1539
if ( filesByName . contains ( emitFilePath ) ) {
1540
1540
const sourceFile = filesByName . get ( emitFilePath ) ;
1541
- if ( isSourceFileJavaScript ( sourceFile ) && options . noEmitOverwriteForJsFiles ) {
1542
- blockEmitingOfFile ( emitFileName ) ;
1543
- }
1544
- else {
1545
- blockEmitingOfFile ( emitFileName , Diagnostics . Cannot_write_file_0_because_it_would_overwrite_input_file ) ;
1546
- }
1541
+ blockEmittingOfFile ( emitFileName , ! ( options . noEmitOverwriteForJsFiles && isSourceFileJavaScript ( sourceFile ) ) && Diagnostics . Cannot_write_file_0_because_it_would_overwrite_input_file ) ;
1547
1542
}
1548
1543
1549
1544
// Report error if multiple files write into same file
1550
1545
if ( emitFilesSeen . contains ( emitFilePath ) ) {
1551
1546
// Already seen the same emit file - report error
1552
- blockEmitingOfFile ( emitFileName , Diagnostics . Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files ) ;
1547
+ blockEmittingOfFile ( emitFileName , Diagnostics . Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files ) ;
1553
1548
}
1554
1549
else {
1555
1550
emitFilesSeen . set ( emitFilePath , true ) ;
@@ -1558,7 +1553,7 @@ namespace ts {
1558
1553
}
1559
1554
}
1560
1555
1561
- function blockEmitingOfFile ( emitFileName : string , message ?: DiagnosticMessage ) {
1556
+ function blockEmittingOfFile ( emitFileName : string , message ?: DiagnosticMessage ) {
1562
1557
hasEmitBlockingDiagnostics . set ( toPath ( emitFileName , currentDirectory , getCanonicalFileName ) , true ) ;
1563
1558
if ( message ) {
1564
1559
programDiagnostics . add ( createCompilerDiagnostic ( message , emitFileName ) ) ;
0 commit comments