@@ -2667,13 +2667,13 @@ namespace ts {
26672667 const languageVersion = options . target || ScriptTarget . ES3 ;
26682668 const outFile = options . outFile || options . out ;
26692669
2670- const firstNonAmbientExternalModuleSourceFile = forEach ( files , f => isExternalModule ( f ) && ! f . isDeclarationFile ? f : undefined ) ;
2670+ const firstNonAmbientExternalModuleSourceFile = find ( files , f => isExternalModule ( f ) && ! f . isDeclarationFile ) ;
26712671 if ( options . isolatedModules ) {
26722672 if ( options . module === ModuleKind . None && languageVersion < ScriptTarget . ES2015 ) {
26732673 createDiagnosticForOptionName ( Diagnostics . Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher , "isolatedModules" , "target" ) ;
26742674 }
26752675
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 ) ;
26772677 if ( firstNonExternalModuleSourceFile ) {
26782678 const span = getErrorSpanForNode ( firstNonExternalModuleSourceFile , firstNonExternalModuleSourceFile ) ;
26792679 programDiagnostics . add ( createFileDiagnostic ( firstNonExternalModuleSourceFile , span . start , span . length , Diagnostics . Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided ) ) ;
@@ -2716,7 +2716,7 @@ namespace ts {
27162716 const dir = getCommonSourceDirectory ( ) ;
27172717
27182718 // 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 ) ) {
27202720 createDiagnosticForOptionName ( Diagnostics . Cannot_find_the_common_subdirectory_path_for_the_input_files , "outDir" ) ;
27212721 }
27222722 }
0 commit comments