@@ -509,12 +509,17 @@ namespace ts {
509
509
let optionNameMapCache : OptionNameMap ;
510
510
511
511
/* @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
514
514
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 ;
517
521
}
522
+ return typeAcquisition ;
518
523
}
519
524
520
525
/* @internal */
@@ -859,7 +864,8 @@ namespace ts {
859
864
}
860
865
861
866
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.
863
869
const jsonOptions = json [ "typeAcquisition" ] || json [ "typingOptions" ] ;
864
870
const typeAcquisition : TypeAcquisition = convertTypeAcquisitionFromJsonWorker ( jsonOptions , basePath , errors , configFileName ) ;
865
871
@@ -1034,8 +1040,8 @@ namespace ts {
1034
1040
basePath : string , errors : Diagnostic [ ] , configFileName ?: string ) : TypeAcquisition {
1035
1041
1036
1042
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 ) ;
1039
1045
1040
1046
return options ;
1041
1047
}
0 commit comments