Skip to content

Commit a097d55

Browse files
authored
Remove long deprecated typingOptions and enableAutoDiscovery (microsoft#52339)
1 parent 35d76b0 commit a097d55

File tree

8 files changed

+10
-110
lines changed

8 files changed

+10
-110
lines changed

src/compiler/commandLineParser.ts

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,14 +1617,6 @@ export const buildOpts: CommandLineOption[] = [
16171617

16181618
/** @internal */
16191619
export const typeAcquisitionDeclarations: CommandLineOption[] = [
1620-
{
1621-
/* @deprecated typingOptions.enableAutoDiscovery
1622-
* Use typeAcquisition.enable instead.
1623-
*/
1624-
name: "enableAutoDiscovery",
1625-
type: "boolean",
1626-
defaultValueDescription: false,
1627-
},
16281620
{
16291621
name: "enable",
16301622
type: "boolean",
@@ -1695,19 +1687,6 @@ export const defaultInitCompilerOptions: CompilerOptions = {
16951687
skipLibCheck: true
16961688
};
16971689

1698-
/** @internal */
1699-
export function convertEnableAutoDiscoveryToEnable(typeAcquisition: TypeAcquisition): TypeAcquisition {
1700-
// Convert deprecated typingOptions.enableAutoDiscovery to typeAcquisition.enable
1701-
if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) {
1702-
return {
1703-
enable: typeAcquisition.enableAutoDiscovery,
1704-
include: typeAcquisition.include || [],
1705-
exclude: typeAcquisition.exclude || []
1706-
};
1707-
}
1708-
return typeAcquisition;
1709-
}
1710-
17111690
/** @internal */
17121691
export function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic {
17131692
return createDiagnosticForInvalidCustomType(opt, createCompilerDiagnostic);
@@ -2194,12 +2173,6 @@ function getTsconfigRootOptionsMap() {
21942173
elementOptions: getCommandLineWatchOptionsMap(),
21952174
extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics,
21962175
},
2197-
{
2198-
name: "typingOptions",
2199-
type: "object",
2200-
elementOptions: getCommandLineTypeAcquisitionMap(),
2201-
extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics,
2202-
},
22032176
{
22042177
name: "typeAcquisition",
22052178
type: "object",
@@ -3282,9 +3255,7 @@ function parseOwnConfigOfJson(
32823255
}
32833256

32843257
const options = convertCompilerOptionsFromJsonWorker(json.compilerOptions, basePath, errors, configFileName);
3285-
// typingOptions has been deprecated and is only supported for backward compatibility purposes.
3286-
// It should be removed in future releases - use typeAcquisition instead.
3287-
const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition || json.typingOptions, basePath, errors, configFileName);
3258+
const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition, basePath, errors, configFileName);
32883259
const watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors);
32893260
json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
32903261
let extendedConfigPath: string | string[] | undefined;
@@ -3322,7 +3293,7 @@ function parseOwnConfigOfJsonSourceFile(
33223293
errors: Push<Diagnostic>
33233294
): ParsedTsconfig {
33243295
const options = getDefaultCompilerOptions(configFileName);
3325-
let typeAcquisition: TypeAcquisition | undefined, typingOptionstypeAcquisition: TypeAcquisition | undefined;
3296+
let typeAcquisition: TypeAcquisition | undefined;
33263297
let watchOptions: WatchOptions | undefined;
33273298
let extendedConfigPath: string | string[] | undefined;
33283299
let rootCompilerOptions: PropertyName[] | undefined;
@@ -3340,9 +3311,6 @@ function parseOwnConfigOfJsonSourceFile(
33403311
case "typeAcquisition":
33413312
currentOption = (typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName)));
33423313
break;
3343-
case "typingOptions":
3344-
currentOption = (typingOptionstypeAcquisition || (typingOptionstypeAcquisition = getDefaultTypeAcquisition(configFileName)));
3345-
break;
33463314
default:
33473315
Debug.fail("Unknown option");
33483316
}
@@ -3394,18 +3362,7 @@ function parseOwnConfigOfJsonSourceFile(
33943362
const json = convertConfigFileToObject(sourceFile, errors, /*reportOptionsErrors*/ true, optionsIterator);
33953363

33963364
if (!typeAcquisition) {
3397-
if (typingOptionstypeAcquisition) {
3398-
typeAcquisition = (typingOptionstypeAcquisition.enableAutoDiscovery !== undefined) ?
3399-
{
3400-
enable: typingOptionstypeAcquisition.enableAutoDiscovery,
3401-
include: typingOptionstypeAcquisition.include,
3402-
exclude: typingOptionstypeAcquisition.exclude
3403-
} :
3404-
typingOptionstypeAcquisition;
3405-
}
3406-
else {
3407-
typeAcquisition = getDefaultTypeAcquisition(configFileName);
3408-
}
3365+
typeAcquisition = getDefaultTypeAcquisition(configFileName);
34093366
}
34103367

34113368
if (rootCompilerOptions && json && json.compilerOptions === undefined) {
@@ -3539,9 +3496,7 @@ function convertTypeAcquisitionFromJsonWorker(jsonOptions: any,
35393496
basePath: string, errors: Push<Diagnostic>, configFileName?: string): TypeAcquisition {
35403497

35413498
const options = getDefaultTypeAcquisition(configFileName);
3542-
const typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions);
3543-
3544-
convertOptionsFromJson(getCommandLineTypeAcquisitionMap(), typeAcquisition, basePath, options, typeAcquisitionDidYouMeanDiagnostics, errors);
3499+
convertOptionsFromJson(getCommandLineTypeAcquisitionMap(), jsonOptions, basePath, options, typeAcquisitionDidYouMeanDiagnostics, errors);
35453500
return options;
35463501
}
35473502

src/compiler/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7125,11 +7125,6 @@ export interface WatchOptions {
71257125
}
71267126

71277127
export interface TypeAcquisition {
7128-
/**
7129-
* @deprecated typingOptions.enableAutoDiscovery
7130-
* Use typeAcquisition.enable instead.
7131-
*/
7132-
enableAutoDiscovery?: boolean;
71337128
enable?: boolean;
71347129
include?: string[];
71357130
exclude?: string[];

src/server/editorServices.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ import {
6565
contains,
6666
containsPath,
6767
convertCompilerOptionsForTelemetry,
68-
convertEnableAutoDiscoveryToEnable,
6968
convertJsonOption,
7069
createCachedDirectoryStructureHost,
7170
createDocumentRegistryInternal,
@@ -4084,7 +4083,7 @@ export class ProjectService {
40844083
}
40854084
else {
40864085
let exclude = false;
4087-
if (typeAcquisition.enable || typeAcquisition.enableAutoDiscovery) {
4086+
if (typeAcquisition.enable) {
40884087
const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i]));
40894088
if (fileExtensionIs(baseName, "js")) {
40904089
const inferredTypingName = removeFileExtension(baseName);
@@ -4119,12 +4118,6 @@ export class ProjectService {
41194118
}
41204119

41214120
openExternalProject(proj: protocol.ExternalProject): void {
4122-
// typingOptions has been deprecated and is only supported for backward compatibility
4123-
// purposes. It should be removed in future releases - use typeAcquisition instead.
4124-
if (proj.typingOptions && !proj.typeAcquisition) {
4125-
const typeAcquisition = convertEnableAutoDiscoveryToEnable(proj.typingOptions);
4126-
proj.typeAcquisition = typeAcquisition;
4127-
}
41284121
proj.typeAcquisition = proj.typeAcquisition || {};
41294122
proj.typeAcquisition.include = proj.typeAcquisition.include || [];
41304123
proj.typeAcquisition.exclude = proj.typeAcquisition.exclude || [];

src/server/protocol.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,10 +1414,6 @@ export interface ExternalProject {
14141414
* Compiler options for the project
14151415
*/
14161416
options: ExternalProjectCompilerOptions;
1417-
/**
1418-
* @deprecated typingOptions. Use typeAcquisition instead
1419-
*/
1420-
typingOptions?: TypeAcquisition;
14211417
/**
14221418
* Explicitly specified type acquisition for the project
14231419
*/

src/testRunner/unittests/config/convertTypeAcquisitionFromJson.ts

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => {
3232
}
3333

3434
function assertTypeAcquisitionWithJson(json: any, configFileName: string, expectedResult: ExpectedResult) {
35-
const jsonOptions = json.typeAcquisition || json.typingOptions;
35+
const jsonOptions = json.typeAcquisition;
3636
const { options: actualTypeAcquisition, errors: actualErrors } = ts.convertTypeAcquisitionFromJson(jsonOptions, "/apath/", configFileName);
3737
verifyAcquisition(actualTypeAcquisition, expectedResult);
3838
verifyErrors(actualErrors, expectedResult);
@@ -51,30 +51,6 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => {
5151
verifyErrors(actualErrors, expectedResult, /*hasLocation*/ true);
5252
}
5353

54-
// tsconfig.json
55-
it("Convert deprecated typingOptions.enableAutoDiscovery format tsconfig.json to typeAcquisition ", () => {
56-
assertTypeAcquisition(
57-
{
58-
typingOptions:
59-
{
60-
enableAutoDiscovery: true,
61-
include: ["0.d.ts", "1.d.ts"],
62-
exclude: ["0.js", "1.js"]
63-
}
64-
},
65-
"tsconfig.json",
66-
{
67-
typeAcquisition:
68-
{
69-
enable: true,
70-
include: ["0.d.ts", "1.d.ts"],
71-
exclude: ["0.js", "1.js"]
72-
},
73-
errors: [] as ts.Diagnostic[]
74-
}
75-
);
76-
});
77-
7854
it("Convert correctly format tsconfig.json to typeAcquisition ", () => {
7955
assertTypeAcquisition(
8056
{
@@ -114,8 +90,8 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => {
11490
},
11591
errors: [
11692
{
117-
category: ts.Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1.category,
118-
code: ts.Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1.code,
93+
category: ts.Diagnostics.Unknown_type_acquisition_option_0.category,
94+
code: ts.Diagnostics.Unknown_type_acquisition_option_0.code,
11995
file: undefined,
12096
start: 0,
12197
length: 0,
@@ -209,8 +185,8 @@ describe("unittests:: config:: convertTypeAcquisitionFromJson", () => {
209185
},
210186
errors: [
211187
{
212-
category: ts.Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1.category,
213-
code: ts.Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1.code,
188+
category: ts.Diagnostics.Unknown_type_acquisition_option_0.category,
189+
code: ts.Diagnostics.Unknown_type_acquisition_option_0.code,
214190
file: undefined,
215191
start: 0,
216192
length: 0,

src/testRunner/unittests/tsserver/telemetry.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ describe("unittests:: tsserver:: project telemetry", () => {
200200
compilerOptions: {},
201201
typeAcquisition: {
202202
enable: true,
203-
enableAutoDiscovery: false,
204203
include: ["hunter2", "hunter3"],
205204
exclude: [],
206205
},

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,10 +1144,6 @@ declare namespace ts {
11441144
* Compiler options for the project
11451145
*/
11461146
options: ExternalProjectCompilerOptions;
1147-
/**
1148-
* @deprecated typingOptions. Use typeAcquisition instead
1149-
*/
1150-
typingOptions?: TypeAcquisition;
11511147
/**
11521148
* Explicitly specified type acquisition for the project
11531149
*/
@@ -7145,11 +7141,6 @@ declare namespace ts {
71457141
[option: string]: CompilerOptionsValue | undefined;
71467142
}
71477143
interface TypeAcquisition {
7148-
/**
7149-
* @deprecated typingOptions.enableAutoDiscovery
7150-
* Use typeAcquisition.enable instead.
7151-
*/
7152-
enableAutoDiscovery?: boolean;
71537144
enable?: boolean;
71547145
include?: string[];
71557146
exclude?: string[];

tests/baselines/reference/api/typescript.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3166,11 +3166,6 @@ declare namespace ts {
31663166
[option: string]: CompilerOptionsValue | undefined;
31673167
}
31683168
interface TypeAcquisition {
3169-
/**
3170-
* @deprecated typingOptions.enableAutoDiscovery
3171-
* Use typeAcquisition.enable instead.
3172-
*/
3173-
enableAutoDiscovery?: boolean;
31743169
enable?: boolean;
31753170
include?: string[];
31763171
exclude?: string[];

0 commit comments

Comments
 (0)