@@ -2351,9 +2351,30 @@ namespace ts {
2351
2351
return false ;
2352
2352
}
2353
2353
2354
- return forEachEmittedFile ( getEmitHost ( ) , ( { jsFilePath, declarationFilePath } ) =>
2355
- isSameFile ( jsFilePath , file ) ||
2356
- ( declarationFilePath && isSameFile ( declarationFilePath , file ) ) ) ;
2354
+ // If this is source file, its not emitted file
2355
+ const filePath = toPath ( file ) ;
2356
+ if ( getSourceFileByPath ( filePath ) ) {
2357
+ return false ;
2358
+ }
2359
+
2360
+ // If options have --outFile or --out just check that
2361
+ const out = options . outFile || options . out ;
2362
+ if ( out ) {
2363
+ return isSameFile ( filePath , out ) || isSameFile ( filePath , removeFileExtension ( out ) + Extension . Dts ) ;
2364
+ }
2365
+
2366
+ // If --outDir, check if file is in that directory
2367
+ if ( options . outDir ) {
2368
+ return containsPath ( options . outDir , filePath , currentDirectory , ! host . useCaseSensitiveFileNames ( ) ) ;
2369
+ }
2370
+
2371
+ if ( fileExtensionIsOneOf ( filePath , supportedJavascriptExtensions ) || fileExtensionIs ( filePath , Extension . Dts ) ) {
2372
+ // Otherwise just check if sourceFile with the name exists
2373
+ const filePathWithoutExtension = removeFileExtension ( filePath ) ;
2374
+ return ! ! getSourceFileByPath ( combinePaths ( filePathWithoutExtension , Extension . Ts ) as Path ) ||
2375
+ ! ! getSourceFileByPath ( combinePaths ( filePathWithoutExtension , Extension . Tsx ) as Path ) ;
2376
+ }
2377
+ return false ;
2357
2378
}
2358
2379
2359
2380
function isSameFile ( file1 : string , file2 : string ) {
0 commit comments