@@ -2667,13 +2667,13 @@ namespace ts {
2667
2667
const languageVersion = options . target || ScriptTarget . ES3 ;
2668
2668
const outFile = options . outFile || options . out ;
2669
2669
2670
- const firstNonAmbientExternalModuleSourceFile = forEach ( files , f => isExternalModule ( f ) && ! f . isDeclarationFile ? f : undefined ) ;
2670
+ const firstNonAmbientExternalModuleSourceFile = find ( files , f => isExternalModule ( f ) && ! f . isDeclarationFile ) ;
2671
2671
if ( options . isolatedModules ) {
2672
2672
if ( options . module === ModuleKind . None && languageVersion < ScriptTarget . ES2015 ) {
2673
2673
createDiagnosticForOptionName ( Diagnostics . Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher , "isolatedModules" , "target" ) ;
2674
2674
}
2675
2675
2676
- const firstNonExternalModuleSourceFile = forEach ( files , f => ! isExternalModule ( f ) && ! f . isDeclarationFile ? f : undefined ) ;
2676
+ const firstNonExternalModuleSourceFile = find ( files , f => ! isExternalModule ( f ) && ! f . isDeclarationFile && f . scriptKind !== ScriptKind . JSON ) ;
2677
2677
if ( firstNonExternalModuleSourceFile ) {
2678
2678
const span = getErrorSpanForNode ( firstNonExternalModuleSourceFile , firstNonExternalModuleSourceFile ) ;
2679
2679
programDiagnostics . add ( createFileDiagnostic ( firstNonExternalModuleSourceFile , span . start , span . length , Diagnostics . Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided ) ) ;
@@ -2716,7 +2716,7 @@ namespace ts {
2716
2716
const dir = getCommonSourceDirectory ( ) ;
2717
2717
2718
2718
// If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure
2719
- if ( options . outDir && dir === "" && forEach ( files , file => getRootLength ( file . fileName ) > 1 ) ) {
2719
+ if ( options . outDir && dir === "" && files . some ( file => getRootLength ( file . fileName ) > 1 ) ) {
2720
2720
createDiagnosticForOptionName ( Diagnostics . Cannot_find_the_common_subdirectory_path_for_the_input_files , "outDir" ) ;
2721
2721
}
2722
2722
}
0 commit comments