@@ -1008,9 +1008,15 @@ namespace ts {
1008
1008
return ts . toPath ( fileName , currentDirectory , getCanonicalFileName ) ;
1009
1009
}
1010
1010
1011
+ function isValidSourceFileForEmit ( file : SourceFile ) {
1012
+ // source file is allowed to be emitted and its not source of project reference redirect
1013
+ return sourceFileMayBeEmitted ( file , options , isSourceFileFromExternalLibrary , getResolvedProjectReferenceToRedirect ) &&
1014
+ ! isSourceOfProjectReferenceRedirect ( file . fileName ) ;
1015
+ }
1016
+
1011
1017
function getCommonSourceDirectory ( ) {
1012
1018
if ( commonSourceDirectory === undefined ) {
1013
- const emittedFiles = filter ( files , file => sourceFileMayBeEmitted ( file , options , isSourceFileFromExternalLibrary , getResolvedProjectReferenceToRedirect ) ) ;
1019
+ const emittedFiles = filter ( files , file => isValidSourceFileForEmit ( file ) ) ;
1014
1020
if ( options . rootDir && checkSourceFilesBelongToPath ( emittedFiles , options . rootDir ) ) {
1015
1021
// If a rootDir is specified use it as the commonSourceDirectory
1016
1022
commonSourceDirectory = getNormalizedAbsolutePath ( options . rootDir , currentDirectory ) ;
@@ -2933,8 +2939,7 @@ namespace ts {
2933
2939
const rootPaths = arrayToSet ( rootNames , toPath ) ;
2934
2940
for ( const file of files ) {
2935
2941
// Ignore file that is not emitted
2936
- if ( ! sourceFileMayBeEmitted ( file , options , isSourceFileFromExternalLibrary , getResolvedProjectReferenceToRedirect ) ) continue ;
2937
- if ( ! rootPaths . has ( file . path ) ) {
2942
+ if ( isValidSourceFileForEmit ( file ) && ! rootPaths . has ( file . path ) ) {
2938
2943
addProgramDiagnosticAtRefPath (
2939
2944
file ,
2940
2945
rootPaths ,
0 commit comments