Skip to content

Commit 70795af

Browse files
committed
Deprecate baseUrl (microsoft#62509)
1 parent 99cf9b3 commit 70795af

File tree

522 files changed

+8052
-15600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

522 files changed

+8052
-15600
lines changed

src/compiler/diagnosticMessages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4717,6 +4717,10 @@
47174717
"category": "Error",
47184718
"code": 5110
47194719
},
4720+
"Visit https://aka.ms/ts6 for migration information.": {
4721+
"category": "Message",
4722+
"code": 5111
4723+
},
47204724

47214725
"Generates a sourcemap for each corresponding '.d.ts' file.": {
47224726
"category": "Message",

src/compiler/program.ts

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4446,8 +4446,8 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
44464446
function checkDeprecations(
44474447
deprecatedIn: string,
44484448
removedIn: string,
4449-
createDiagnostic: (name: string, value: string | undefined, useInstead: string | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) => void,
4450-
fn: (createDeprecatedDiagnostic: (name: string, value?: string, useInstead?: string) => void) => void,
4449+
createDiagnostic: (name: string, value: string | undefined, useInstead: string | undefined, related: DiagnosticMessage | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) => void,
4450+
fn: (createDeprecatedDiagnostic: (name: string, value?: string, useInstead?: string, related?: DiagnosticMessage) => void) => void,
44514451
) {
44524452
const deprecatedInVersion = new Version(deprecatedIn);
44534453
const removedInVersion = new Version(removedIn);
@@ -4458,36 +4458,44 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
44584458
const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === Comparison.LessThan;
44594459

44604460
if (mustBeRemoved || canBeSilenced) {
4461-
fn((name, value, useInstead) => {
4461+
fn((name, value, useInstead, related) => {
44624462
if (mustBeRemoved) {
44634463
if (value === undefined) {
4464-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
4464+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
44654465
}
44664466
else {
4467-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
4467+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
44684468
}
44694469
}
44704470
else {
44714471
if (value === undefined) {
4472-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
4472+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
44734473
}
44744474
else {
4475-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
4475+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
44764476
}
44774477
}
44784478
});
44794479
}
44804480
}
44814481

44824482
function verifyDeprecatedCompilerOptions() {
4483-
function createDiagnostic(name: string, value: string | undefined, useInstead: string | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) {
4483+
function createDiagnostic(name: string, value: string | undefined, useInstead: string | undefined, related: DiagnosticMessage | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) {
44844484
if (useInstead) {
4485-
const details = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Use_0_instead, useInstead);
4485+
let details = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Use_0_instead, useInstead);
4486+
if (related) {
4487+
details = chainDiagnosticMessages(details, related);
4488+
}
44864489
const chain = chainDiagnosticMessages(details, message, ...args);
44874490
createDiagnosticForOption(/*onKey*/ !value, name, /*option2*/ undefined, chain);
44884491
}
44894492
else {
4490-
createDiagnosticForOption(/*onKey*/ !value, name, /*option2*/ undefined, message, ...args);
4493+
let details: DiagnosticMessageChain | undefined;
4494+
if (related) {
4495+
details = chainDiagnosticMessages(/*details*/ undefined, related);
4496+
}
4497+
const chain = chainDiagnosticMessages(details, message, ...args);
4498+
createDiagnosticForOption(/*onKey*/ !value, name, /*option2*/ undefined, chain);
44914499
}
44924500
}
44934501

@@ -4526,7 +4534,10 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
45264534

45274535
checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => {
45284536
if (options.moduleResolution === ModuleResolutionKind.Node10) {
4529-
createDeprecatedDiagnostic("moduleResolution", "node10");
4537+
createDeprecatedDiagnostic("moduleResolution", "node10", /*useInstead*/ undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information);
4538+
}
4539+
if (options.baseUrl !== undefined) {
4540+
createDeprecatedDiagnostic("baseUrl", /*value*/ undefined, /*useInstead*/ undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information);
45304541
}
45314542
if (options.moduleResolution === ModuleResolutionKind.Classic) {
45324543
createDeprecatedDiagnostic("moduleResolution", "classic");
@@ -4538,7 +4549,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
45384549
}
45394550

45404551
function verifyDeprecatedProjectReference(ref: ProjectReference, parentFile: JsonSourceFile | undefined, index: number) {
4541-
function createDiagnostic(_name: string, _value: string | undefined, _useInstead: string | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) {
4552+
function createDiagnostic(_name: string, _value: string | undefined, _useInstead: string | undefined, _related: DiagnosticMessage | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) {
45424553
createDiagnosticForReference(parentFile, index, message, ...args);
45434554
}
45444555

src/compiler/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7419,6 +7419,7 @@ export interface CompilerOptions {
74197419
allowUnreachableCode?: boolean;
74207420
allowUnusedLabels?: boolean;
74217421
alwaysStrict?: boolean; // Always combine with strict property
7422+
/** @deprecated */
74227423
baseUrl?: string;
74237424
/**
74247425
* An error if set - this should only go through the -b pipeline and not actually be observed

tests/baselines/reference/allowSyntheticDefaultImports3.errors.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
<<<<<<< HEAD
2-
||||||| parent of 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
3-
error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
4-
=======
5-
error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
61
error TS5107: Option 'module=System' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
7-
>>>>>>> 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
82
a.ts(1,8): error TS1192: Module '"b"' has no default export.
93

104

11-
<<<<<<< HEAD
12-
||||||| parent of 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
13-
!!! error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
14-
=======
15-
!!! error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
165
!!! error TS5107: Option 'module=System' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
17-
>>>>>>> 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
186
==== a.ts (1 errors) ====
197
import Namespace from "./b";
208
~~~~~~~~~

tests/baselines/reference/allowSyntheticDefaultImports6.errors.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
<<<<<<< HEAD
2-
||||||| parent of 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
3-
error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
4-
=======
5-
error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
61
error TS5107: Option 'module=System' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
7-
>>>>>>> 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
82
a.ts(1,8): error TS1259: Module '"b"' can only be default-imported using the 'esModuleInterop' flag
93

104

11-
<<<<<<< HEAD
12-
||||||| parent of 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
13-
!!! error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
14-
=======
15-
!!! error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
165
!!! error TS5107: Option 'module=System' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
17-
>>>>>>> 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
186
==== b.d.ts (0 errors) ====
197
declare class Foo {
208
member: string;

tests/baselines/reference/allowSyntheticDefaultImports8.errors.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
<<<<<<< HEAD
2-
||||||| parent of 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
3-
error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
4-
=======
5-
error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
61
error TS5107: Option 'module=System' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
7-
>>>>>>> 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
82
a.ts(1,10): error TS2305: Module '"./b"' has no exported member 'default'.
93

104

11-
<<<<<<< HEAD
12-
||||||| parent of 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
13-
!!! error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
14-
=======
15-
!!! error TS5107: Option 'allowSyntheticDefaultImports=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
165
!!! error TS5107: Option 'module=System' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
17-
>>>>>>> 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
186
==== b.d.ts (0 errors) ====
197
export function foo();
208

tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,9 @@ import ext = require("ext");
1313
var x = ext;
1414

1515
//// [ambientExternalModuleInAnotherExternalModule.js]
16-
<<<<<<< HEAD
17-
define(["require", "exports", "ext"], function (require, exports, ext) {
18-
"use strict";
19-
class D {
20-
}
21-
var x = ext;
22-
||||||| parent of 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
23-
define(["require", "exports", "ext"], function (require, exports, ext) {
24-
"use strict";
25-
var D = /** @class */ (function () {
26-
function D() {
27-
}
28-
return D;
29-
}());
30-
var x = ext;
31-
=======
3216
"use strict";
33-
var D = /** @class */ (function () {
34-
function D() {
35-
}
36-
>>>>>>> 42f6576e83 (Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolution classic`; change defaults (#62669))
37-
return D;
38-
}());
17+
class D {
18+
}
3919
// Cannot resolve this ext module reference
4020
var ext = require("ext");
4121
var x = ext;

tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ error TS5107: Option 'module=AMD' is deprecated and will stop functioning in Typ
88
var c = new A();
99
==== ambientExternalModuleWithInternalImportDeclaration_0.ts (0 errors) ====
1010
declare module 'M' {
11-
namespace C {
11+
module C {
1212
export var f: number;
1313
}
1414
class C {

tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ error TS5107: Option 'module=AMD' is deprecated and will stop functioning in Typ
88
var c = new A();
99
==== ambientExternalModuleWithoutInternalImportDeclaration_0.ts (0 errors) ====
1010
declare module 'M' {
11-
namespace C {
11+
module C {
1212
export var f: number;
1313
}
1414
class C {

tests/baselines/reference/ambientInsideNonAmbientExternalModule.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ error TS5107: Option 'module=AMD' is deprecated and will stop functioning in Typ
77
export declare function f();
88
export declare class C { }
99
export declare enum E { }
10-
export declare namespace M { }
10+
export declare module M { }

0 commit comments

Comments
 (0)