@@ -1111,10 +1111,11 @@ namespace ts {
11111111 const jsonOptions = json [ "typeAcquisition" ] || json [ "typingOptions" ] ;
11121112 const typeAcquisition : TypeAcquisition = convertTypeAcquisitionFromJsonWorker ( jsonOptions , basePath , errors , configFileName ) ;
11131113
1114+ let baseCompileOnSave : boolean ;
11141115 if ( json [ "extends" ] ) {
11151116 let [ include , exclude , files , baseOptions ] : [ string [ ] , string [ ] , string [ ] , CompilerOptions ] = [ undefined , undefined , undefined , { } ] ;
11161117 if ( typeof json [ "extends" ] === "string" ) {
1117- [ include , exclude , files , baseOptions ] = ( tryExtendsName ( json [ "extends" ] ) || [ include , exclude , files , baseOptions ] ) ;
1118+ [ include , exclude , files , baseCompileOnSave , baseOptions ] = ( tryExtendsName ( json [ "extends" ] ) || [ include , exclude , files , baseCompileOnSave , baseOptions ] ) ;
11181119 }
11191120 else {
11201121 errors . push ( createCompilerDiagnostic ( Diagnostics . Compiler_option_0_requires_a_value_of_type_1 , "extends" , "string" ) ) ;
@@ -1135,7 +1136,10 @@ namespace ts {
11351136 options . configFilePath = configFileName ;
11361137
11371138 const { fileNames, wildcardDirectories } = getFileNames ( errors ) ;
1138- const compileOnSave = convertCompileOnSaveOptionFromJson ( json , basePath , errors ) ;
1139+ let compileOnSave = convertCompileOnSaveOptionFromJson ( json , basePath , errors ) ;
1140+ if ( baseCompileOnSave && json [ compileOnSaveCommandLineOption . name ] === undefined ) {
1141+ compileOnSave = baseCompileOnSave ;
1142+ }
11391143
11401144 return {
11411145 options,
@@ -1147,7 +1151,7 @@ namespace ts {
11471151 compileOnSave
11481152 } ;
11491153
1150- function tryExtendsName ( extendedConfig : string ) : [ string [ ] , string [ ] , string [ ] , CompilerOptions ] {
1154+ function tryExtendsName ( extendedConfig : string ) : [ string [ ] , string [ ] , string [ ] , boolean , CompilerOptions ] {
11511155 // If the path isn't a rooted or relative path, don't try to resolve it (we reserve the right to special case module-id like paths in the future)
11521156 if ( ! ( isRootedDiskPath ( extendedConfig ) || startsWith ( normalizeSlashes ( extendedConfig ) , "./" ) || startsWith ( normalizeSlashes ( extendedConfig ) , "../" ) ) ) {
11531157 errors . push ( createCompilerDiagnostic ( Diagnostics . A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not , extendedConfig ) ) ;
@@ -1177,7 +1181,7 @@ namespace ts {
11771181 return map ( extendedResult . config [ key ] , updatePath ) ;
11781182 }
11791183 } ) ;
1180- return [ include , exclude , files , result . options ] ;
1184+ return [ include , exclude , files , result . compileOnSave , result . options ] ;
11811185 }
11821186
11831187 function getFileNames ( errors : Diagnostic [ ] ) : ExpandResult {
@@ -1245,7 +1249,7 @@ namespace ts {
12451249 }
12461250 }
12471251
1248- export function convertCompileOnSaveOptionFromJson ( jsonOption : any , basePath : string , errors : Diagnostic [ ] ) : boolean {
1252+ export function convertCompileOnSaveOptionFromJson ( jsonOption : any , basePath : string , errors : Diagnostic [ ] ) : boolean | undefined {
12491253 if ( ! hasProperty ( jsonOption , compileOnSaveCommandLineOption . name ) ) {
12501254 return false ;
12511255 }
0 commit comments