@@ -1111,10 +1111,11 @@ namespace ts {
1111
1111
const jsonOptions = json [ "typeAcquisition" ] || json [ "typingOptions" ] ;
1112
1112
const typeAcquisition : TypeAcquisition = convertTypeAcquisitionFromJsonWorker ( jsonOptions , basePath , errors , configFileName ) ;
1113
1113
1114
+ let baseCompileOnSave : boolean ;
1114
1115
if ( json [ "extends" ] ) {
1115
1116
let [ include , exclude , files , baseOptions ] : [ string [ ] , string [ ] , string [ ] , CompilerOptions ] = [ undefined , undefined , undefined , { } ] ;
1116
1117
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 ] ) ;
1118
1119
}
1119
1120
else {
1120
1121
errors . push ( createCompilerDiagnostic ( Diagnostics . Compiler_option_0_requires_a_value_of_type_1 , "extends" , "string" ) ) ;
@@ -1135,7 +1136,10 @@ namespace ts {
1135
1136
options . configFilePath = configFileName ;
1136
1137
1137
1138
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
+ }
1139
1143
1140
1144
return {
1141
1145
options,
@@ -1147,7 +1151,7 @@ namespace ts {
1147
1151
compileOnSave
1148
1152
} ;
1149
1153
1150
- function tryExtendsName ( extendedConfig : string ) : [ string [ ] , string [ ] , string [ ] , CompilerOptions ] {
1154
+ function tryExtendsName ( extendedConfig : string ) : [ string [ ] , string [ ] , string [ ] , boolean , CompilerOptions ] {
1151
1155
// 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)
1152
1156
if ( ! ( isRootedDiskPath ( extendedConfig ) || startsWith ( normalizeSlashes ( extendedConfig ) , "./" ) || startsWith ( normalizeSlashes ( extendedConfig ) , "../" ) ) ) {
1153
1157
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 {
1177
1181
return map ( extendedResult . config [ key ] , updatePath ) ;
1178
1182
}
1179
1183
} ) ;
1180
- return [ include , exclude , files , result . options ] ;
1184
+ return [ include , exclude , files , result . compileOnSave , result . options ] ;
1181
1185
}
1182
1186
1183
1187
function getFileNames ( errors : Diagnostic [ ] ) : ExpandResult {
@@ -1245,7 +1249,7 @@ namespace ts {
1245
1249
}
1246
1250
}
1247
1251
1248
- export function convertCompileOnSaveOptionFromJson ( jsonOption : any , basePath : string , errors : Diagnostic [ ] ) : boolean {
1252
+ export function convertCompileOnSaveOptionFromJson ( jsonOption : any , basePath : string , errors : Diagnostic [ ] ) : boolean | undefined {
1249
1253
if ( ! hasProperty ( jsonOption , compileOnSaveCommandLineOption . name ) ) {
1250
1254
return false ;
1251
1255
}
0 commit comments