mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Add baseUrl deprecation warning for TypeScript 6.0
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
This commit is contained in:
parent
5f65b57188
commit
b31fc03b89
@ -4525,10 +4525,13 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
|
||||
}
|
||||
});
|
||||
|
||||
checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => {
|
||||
if (options.moduleResolution === ModuleResolutionKind.Node10) {
|
||||
createDeprecatedDiagnostic("moduleResolution", "node10");
|
||||
}
|
||||
checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => {
|
||||
if (options.moduleResolution === ModuleResolutionKind.Node10) {
|
||||
createDeprecatedDiagnostic("moduleResolution", "node10");
|
||||
}
|
||||
if (options.baseUrl) {
|
||||
createDeprecatedDiagnostic("baseUrl");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
/foo/tsconfig.json(3,9): error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
|
||||
|
||||
|
||||
==== /foo/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./src",
|
||||
~~~~~~~~~
|
||||
!!! error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
|
||||
"paths": {
|
||||
"@app/*": ["app/*"],
|
||||
"@lib/*": ["lib/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
==== /foo/src/app/module.ts (0 errors) ====
|
||||
export const value = 42;
|
||||
|
||||
==== /foo/src/main.ts (0 errors) ====
|
||||
import { value } from "@app/module";
|
||||
const result = value;
|
||||
@ -0,0 +1,19 @@
|
||||
//// [tests/cases/compiler/deprecatedCompilerOptionsBaseUrl.ts] ////
|
||||
|
||||
//// [module.ts]
|
||||
export const value = 42;
|
||||
|
||||
//// [main.ts]
|
||||
import { value } from "@app/module";
|
||||
const result = value;
|
||||
|
||||
//// [module.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.value = void 0;
|
||||
exports.value = 42;
|
||||
//// [main.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var module_1 = require("@app/module");
|
||||
var result = module_1.value;
|
||||
@ -0,0 +1,14 @@
|
||||
//// [tests/cases/compiler/deprecatedCompilerOptionsBaseUrl.ts] ////
|
||||
|
||||
=== /foo/src/app/module.ts ===
|
||||
export const value = 42;
|
||||
>value : Symbol(value, Decl(module.ts, 0, 12))
|
||||
|
||||
=== /foo/src/main.ts ===
|
||||
import { value } from "@app/module";
|
||||
>value : Symbol(value, Decl(main.ts, 0, 8))
|
||||
|
||||
const result = value;
|
||||
>result : Symbol(result, Decl(main.ts, 1, 5))
|
||||
>value : Symbol(value, Decl(main.ts, 0, 8))
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
//// [tests/cases/compiler/deprecatedCompilerOptionsBaseUrl.ts] ////
|
||||
|
||||
=== /foo/src/app/module.ts ===
|
||||
export const value = 42;
|
||||
>value : 42
|
||||
> : ^^
|
||||
>42 : 42
|
||||
> : ^^
|
||||
|
||||
=== /foo/src/main.ts ===
|
||||
import { value } from "@app/module";
|
||||
>value : 42
|
||||
> : ^^
|
||||
|
||||
const result = value;
|
||||
>result : 42
|
||||
> : ^^
|
||||
>value : 42
|
||||
> : ^^
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
//// [tests/cases/compiler/deprecatedCompilerOptionsBaseUrlIgnored.ts] ////
|
||||
|
||||
//// [module.ts]
|
||||
export const value = 42;
|
||||
|
||||
//// [main.ts]
|
||||
import { value } from "@app/module";
|
||||
const result = value;
|
||||
|
||||
//// [module.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.value = void 0;
|
||||
exports.value = 42;
|
||||
//// [main.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var module_1 = require("@app/module");
|
||||
var result = module_1.value;
|
||||
@ -0,0 +1,14 @@
|
||||
//// [tests/cases/compiler/deprecatedCompilerOptionsBaseUrlIgnored.ts] ////
|
||||
|
||||
=== /foo/src/app/module.ts ===
|
||||
export const value = 42;
|
||||
>value : Symbol(value, Decl(module.ts, 0, 12))
|
||||
|
||||
=== /foo/src/main.ts ===
|
||||
import { value } from "@app/module";
|
||||
>value : Symbol(value, Decl(main.ts, 0, 8))
|
||||
|
||||
const result = value;
|
||||
>result : Symbol(result, Decl(main.ts, 1, 5))
|
||||
>value : Symbol(value, Decl(main.ts, 0, 8))
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
//// [tests/cases/compiler/deprecatedCompilerOptionsBaseUrlIgnored.ts] ////
|
||||
|
||||
=== /foo/src/app/module.ts ===
|
||||
export const value = 42;
|
||||
>value : 42
|
||||
> : ^^
|
||||
>42 : 42
|
||||
> : ^^
|
||||
|
||||
=== /foo/src/main.ts ===
|
||||
import { value } from "@app/module";
|
||||
>value : 42
|
||||
> : ^^
|
||||
|
||||
const result = value;
|
||||
>result : 42
|
||||
> : ^^
|
||||
>value : 42
|
||||
> : ^^
|
||||
|
||||
18
tests/cases/compiler/deprecatedCompilerOptionsBaseUrl.ts
Normal file
18
tests/cases/compiler/deprecatedCompilerOptionsBaseUrl.ts
Normal file
@ -0,0 +1,18 @@
|
||||
// @typeScriptVersion: 6.0
|
||||
// @filename: /foo/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./src",
|
||||
"paths": {
|
||||
"@app/*": ["app/*"],
|
||||
"@lib/*": ["lib/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /foo/src/app/module.ts
|
||||
export const value = 42;
|
||||
|
||||
// @filename: /foo/src/main.ts
|
||||
import { value } from "@app/module";
|
||||
const result = value;
|
||||
@ -0,0 +1,19 @@
|
||||
// @typeScriptVersion: 6.0
|
||||
// @filename: /foo/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./src",
|
||||
"paths": {
|
||||
"@app/*": ["app/*"],
|
||||
"@lib/*": ["lib/*"]
|
||||
},
|
||||
"ignoreDeprecations": "6.0"
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: /foo/src/app/module.ts
|
||||
export const value = 42;
|
||||
|
||||
// @filename: /foo/src/main.ts
|
||||
import { value } from "@app/module";
|
||||
const result = value;
|
||||
Loading…
x
Reference in New Issue
Block a user