@@ -509,12 +509,17 @@ namespace ts {
509509 let optionNameMapCache : OptionNameMap ;
510510
511511 /* @internal */
512- export function replaceEnableAutoDiscoveryWithEnable ( typeAcquisition : TypeAcquisition ) : void {
513- // Replace deprecated typingOptions.enableAutoDiscovery with typeAcquisition.enable
512+ export function convertEnableAutoDiscoveryToEnable ( typeAcquisition : TypeAcquisition ) : TypeAcquisition {
513+ // Convert deprecated typingOptions.enableAutoDiscovery to typeAcquisition.enable
514514 if ( typeAcquisition && typeAcquisition . enableAutoDiscovery !== undefined && typeAcquisition . enable === undefined ) {
515- typeAcquisition . enable = typeAcquisition . enableAutoDiscovery ;
516- delete typeAcquisition . enableAutoDiscovery ;
515+ const result : TypeAcquisition = {
516+ enable : typeAcquisition . enableAutoDiscovery ,
517+ include : typeAcquisition . include || [ ] ,
518+ exclude : typeAcquisition . exclude || [ ]
519+ } ;
520+ return result ;
517521 }
522+ return typeAcquisition ;
518523 }
519524
520525 /* @internal */
@@ -859,7 +864,8 @@ namespace ts {
859864 }
860865
861866 let options : CompilerOptions = convertCompilerOptionsFromJsonWorker ( json [ "compilerOptions" ] , basePath , errors , configFileName ) ;
862- // typingOptions has been deprecated. Use typeAcquisition instead.
867+ // typingOptions has been deprecated and is only supported for backward compatibility purposes.
868+ // It should be removed in future releases - use typeAcquisition instead.
863869 const jsonOptions = json [ "typeAcquisition" ] || json [ "typingOptions" ] ;
864870 const typeAcquisition : TypeAcquisition = convertTypeAcquisitionFromJsonWorker ( jsonOptions , basePath , errors , configFileName ) ;
865871
@@ -1034,8 +1040,8 @@ namespace ts {
10341040 basePath : string , errors : Diagnostic [ ] , configFileName ?: string ) : TypeAcquisition {
10351041
10361042 const options : TypeAcquisition = { enable : getBaseFileName ( configFileName ) === "jsconfig.json" , include : [ ] , exclude : [ ] } ;
1037- replaceEnableAutoDiscoveryWithEnable ( jsonOptions ) ;
1038- convertOptionsFromJson ( typeAcquisitionDeclarations , jsonOptions , basePath , options , Diagnostics . Unknown_type_acquisition_option_0 , errors ) ;
1043+ const typeAcquisition = convertEnableAutoDiscoveryToEnable ( jsonOptions ) ;
1044+ convertOptionsFromJson ( typeAcquisitionDeclarations , typeAcquisition , basePath , options , Diagnostics . Unknown_type_acquisition_option_0 , errors ) ;
10391045
10401046 return options ;
10411047 }
0 commit comments