From 5f65b571887068cd077e04bd2e6d849fe01676e0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:09:29 +0000 Subject: [PATCH 1/6] Initial plan From b31fc03b89ecb4b33f8e6db42f422d69f35181f6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:23:00 +0000 Subject: [PATCH 2/6] Add baseUrl deprecation warning for TypeScript 6.0 Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> --- src/compiler/program.ts | 11 ++++++---- ...eprecatedCompilerOptionsBaseUrl.errors.txt | 22 +++++++++++++++++++ .../deprecatedCompilerOptionsBaseUrl.js | 19 ++++++++++++++++ .../deprecatedCompilerOptionsBaseUrl.symbols | 14 ++++++++++++ .../deprecatedCompilerOptionsBaseUrl.types | 20 +++++++++++++++++ ...deprecatedCompilerOptionsBaseUrlIgnored.js | 19 ++++++++++++++++ ...catedCompilerOptionsBaseUrlIgnored.symbols | 14 ++++++++++++ ...recatedCompilerOptionsBaseUrlIgnored.types | 20 +++++++++++++++++ .../deprecatedCompilerOptionsBaseUrl.ts | 18 +++++++++++++++ ...deprecatedCompilerOptionsBaseUrlIgnored.ts | 19 ++++++++++++++++ 10 files changed, 172 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.errors.txt create mode 100644 tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.js create mode 100644 tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.symbols create mode 100644 tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.types create mode 100644 tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.js create mode 100644 tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.symbols create mode 100644 tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.types create mode 100644 tests/cases/compiler/deprecatedCompilerOptionsBaseUrl.ts create mode 100644 tests/cases/compiler/deprecatedCompilerOptionsBaseUrlIgnored.ts diff --git a/src/compiler/program.ts b/src/compiler/program.ts index bdfb8d0151bd7..79adcbd04e71f 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -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"); + } }); } diff --git a/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.errors.txt b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.errors.txt new file mode 100644 index 0000000000000..73c4942390f98 --- /dev/null +++ b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.errors.txt @@ -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; \ No newline at end of file diff --git a/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.js b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.js new file mode 100644 index 0000000000000..9fb21bb565b15 --- /dev/null +++ b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.js @@ -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; diff --git a/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.symbols b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.symbols new file mode 100644 index 0000000000000..78639bf650a25 --- /dev/null +++ b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.symbols @@ -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)) + diff --git a/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.types b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.types new file mode 100644 index 0000000000000..a88994f9f399d --- /dev/null +++ b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrl.types @@ -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 +> : ^^ + diff --git a/tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.js b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.js new file mode 100644 index 0000000000000..3f1fd9807af6f --- /dev/null +++ b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.js @@ -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; diff --git a/tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.symbols b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.symbols new file mode 100644 index 0000000000000..c1c22f0c13c32 --- /dev/null +++ b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.symbols @@ -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)) + diff --git a/tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.types b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.types new file mode 100644 index 0000000000000..1e4ee28709b33 --- /dev/null +++ b/tests/baselines/reference/deprecatedCompilerOptionsBaseUrlIgnored.types @@ -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 +> : ^^ + diff --git a/tests/cases/compiler/deprecatedCompilerOptionsBaseUrl.ts b/tests/cases/compiler/deprecatedCompilerOptionsBaseUrl.ts new file mode 100644 index 0000000000000..05ccdd18ac333 --- /dev/null +++ b/tests/cases/compiler/deprecatedCompilerOptionsBaseUrl.ts @@ -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; \ No newline at end of file diff --git a/tests/cases/compiler/deprecatedCompilerOptionsBaseUrlIgnored.ts b/tests/cases/compiler/deprecatedCompilerOptionsBaseUrlIgnored.ts new file mode 100644 index 0000000000000..b35ece912f354 --- /dev/null +++ b/tests/cases/compiler/deprecatedCompilerOptionsBaseUrlIgnored.ts @@ -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; \ No newline at end of file From de7c7eeda54439f265003cd6c75c93b06c2c290d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:30:02 +0000 Subject: [PATCH 3/6] Update some baseUrl tests to ignore deprecations Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> --- ...gBasedModuleResolution2_classic.errors.txt | 20 ------------------- ...gBasedModuleResolution4_classic.trace.json | 7 ------- ...thMappingBasedModuleResolution2_classic.ts | 17 ++++++++-------- ...thMappingBasedModuleResolution3_classic.ts | 7 ++++--- .../pathMappingBasedModuleResolution3_node.ts | 7 ++++--- ...thMappingBasedModuleResolution4_classic.ts | 11 +++++----- 6 files changed, 23 insertions(+), 46 deletions(-) delete mode 100644 tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt deleted file mode 100644 index 3f4b7a24edf25..0000000000000 --- a/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -root/tsconfig.json(5,13): error TS5061: Pattern '*1*' can have at most one '*' character. -root/tsconfig.json(5,22): error TS5062: Substitution '*2*' in pattern '*1*' can have at most one '*' character. - - -==== root/tsconfig.json (2 errors) ==== - { - "compilerOptions": { - "baseUrl": "./src", - "paths": { - "*1*": [ "*2*" ] - ~~~~~ -!!! error TS5061: Pattern '*1*' can have at most one '*' character. - ~~~~~ -!!! error TS5062: Substitution '*2*' in pattern '*1*' can have at most one '*' character. - } - } - } - -==== root/src/folder1/file1.ts (0 errors) ==== - export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json index f00232b0c5193..209824efbe180 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json @@ -1,8 +1,6 @@ [ "======== Resolving module 'folder2/file2' from 'c:/root/folder1/file1.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'.", - "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", "File 'c:/root/folder2/file2.ts' exists - use it as a name resolution result.", "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", @@ -11,11 +9,6 @@ "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'.", - "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", - "File 'c:/root/file4.ts' does not exist.", - "File 'c:/root/file4.tsx' does not exist.", - "File 'c:/root/file4.d.ts' does not exist.", "File 'c:/root/folder2/file4.ts' does not exist.", "File 'c:/root/folder2/file4.tsx' does not exist.", "File 'c:/root/folder2/file4.d.ts' does not exist.", diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts index f24e857fa416f..af258555a2321 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts @@ -4,14 +4,15 @@ // baseurl is defined in tsconfig.json // paths has errors -// @filename: root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": "./src", - "paths": { - "*1*": [ "*2*" ] - } - } +// @filename: root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "*1*": [ "*2*" ] + }, + "ignoreDeprecations": "6.0" + } } // @filename: root/src/folder1/file1.ts diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts index 350346adebcf0..3166ce003695f 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts @@ -1,6 +1,7 @@ -// @moduleResolution: classic -// @module: amd -// @baseUrl: c:/root +// @moduleResolution: classic +// @module: amd +// @baseUrl: c:/root +// @ignoreDeprecations: 6.0 // @traceResolution: true // baseUrl set via command line diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts index 400a3b4ea3d48..353a349591fd2 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts @@ -1,6 +1,7 @@ -// @moduleResolution: bundler -// @module: commonjs -// @baseUrl: c:/root +// @moduleResolution: bundler +// @module: commonjs +// @baseUrl: c:/root +// @ignoreDeprecations: 6.0 // @traceResolution: true // baseUrl set via command line diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts index fbf11e6171646..06028086fc5ad 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts @@ -4,11 +4,12 @@ // baseUrl set via command line -// @filename: c:/root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": "." - } +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0" + } } // @filename: c:/root/folder1/file1.ts From 3db3a9f961354fb1814d085b070afee160bc5c9d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:34:07 +0000 Subject: [PATCH 4/6] Complete baseUrl deprecation implementation with tests and migration examples Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> --- src/compiler/program.ts | 14 +-- .../baseUrlMigrationExample.errors.txt | 58 +++++++++++ .../reference/baseUrlMigrationExample.js | 63 ++++++++++++ .../reference/baseUrlMigrationExample.symbols | 25 +++++ .../reference/baseUrlMigrationExample.types | 37 +++++++ .../cases/compiler/baseUrlMigrationExample.ts | 56 +++++++++++ .../pathMappingBasedModuleResolution2_node.ts | 35 +++---- .../pathMappingBasedModuleResolution4_node.ts | 55 ++++++----- ...thMappingBasedModuleResolution5_classic.ts | 85 ++++++++-------- .../pathMappingBasedModuleResolution5_node.ts | 87 ++++++++-------- ...thMappingBasedModuleResolution7_classic.ts | 99 ++++++++++--------- .../pathMappingBasedModuleResolution7_node.ts | 99 ++++++++++--------- ...thMappingBasedModuleResolution8_classic.ts | 43 ++++---- .../pathMappingBasedModuleResolution8_node.ts | 43 ++++---- ...duleResolution_rootImport_aliasWithRoot.ts | 51 +++++----- ...Import_aliasWithRoot_differentRootTypes.ts | 99 ++++++++++--------- ...ootImport_aliasWithRoot_multipleAliases.ts | 53 +++++----- ...n_rootImport_aliasWithRoot_realRootFile.ts | 51 +++++----- ...leResolution_rootImport_noAliasWithRoot.ts | 51 +++++----- ...rootImport_noAliasWithRoot_realRootFile.ts | 51 +++++----- ...pingBasedModuleResolution_withExtension.ts | 53 +++++----- ...sedModuleResolution_withExtensionInName.ts | 47 ++++----- ...lution_withExtension_MapedToNodeModules.ts | 47 ++++----- ...leResolution_withExtension_failedLookup.ts | 31 +++--- 24 files changed, 795 insertions(+), 538 deletions(-) create mode 100644 tests/baselines/reference/baseUrlMigrationExample.errors.txt create mode 100644 tests/baselines/reference/baseUrlMigrationExample.js create mode 100644 tests/baselines/reference/baseUrlMigrationExample.symbols create mode 100644 tests/baselines/reference/baseUrlMigrationExample.types create mode 100644 tests/cases/compiler/baseUrlMigrationExample.ts diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 79adcbd04e71f..cd71846f8fc72 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -4525,13 +4525,13 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro } }); - checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => { - if (options.moduleResolution === ModuleResolutionKind.Node10) { - createDeprecatedDiagnostic("moduleResolution", "node10"); - } - if (options.baseUrl) { - createDeprecatedDiagnostic("baseUrl"); - } + checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => { + if (options.moduleResolution === ModuleResolutionKind.Node10) { + createDeprecatedDiagnostic("moduleResolution", "node10"); + } + if (options.baseUrl) { + createDeprecatedDiagnostic("baseUrl"); + } }); } diff --git a/tests/baselines/reference/baseUrlMigrationExample.errors.txt b/tests/baselines/reference/baseUrlMigrationExample.errors.txt new file mode 100644 index 0000000000000..f614168ebb547 --- /dev/null +++ b/tests/baselines/reference/baseUrlMigrationExample.errors.txt @@ -0,0 +1,58 @@ +/before/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. + + +==== /before/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/*"] + } + } + } + +==== /before/src/app/module.ts (0 errors) ==== + export const value = 42; + +==== /before/src/lib/utils.ts (0 errors) ==== + export function helper() { return "help"; } + +==== /before/src/main.ts (0 errors) ==== + import { value } from "@app/module"; + import { helper } from "@lib/utils"; + // This would also resolve due to baseUrl: + import * as something from "someModule"; // Resolves to ./src/someModule + +==== /before/src/someModule.ts (0 errors) ==== + export const data = "from baseUrl resolution"; + +==== /after/tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "paths": { + // Explicit prefix for all path mappings + "@app/*": ["./src/app/*"], + "@lib/*": ["./src/lib/*"], + // Optional: preserve baseUrl behavior with catch-all + "*": ["./src/*"] + } + } + } + +==== /after/src/app/module.ts (0 errors) ==== + export const value = 42; + +==== /after/src/lib/utils.ts (0 errors) ==== + export function helper() { return "help"; } + +==== /after/src/main.ts (0 errors) ==== + import { value } from "@app/module"; + import { helper } from "@lib/utils"; + // With explicit catch-all mapping, this still works: + import * as something from "someModule"; // Resolves to ./src/someModule + +==== /after/src/someModule.ts (0 errors) ==== + export const data = "from explicit path mapping"; \ No newline at end of file diff --git a/tests/baselines/reference/baseUrlMigrationExample.js b/tests/baselines/reference/baseUrlMigrationExample.js new file mode 100644 index 0000000000000..64dee7a1f16a4 --- /dev/null +++ b/tests/baselines/reference/baseUrlMigrationExample.js @@ -0,0 +1,63 @@ +//// [tests/cases/compiler/baseUrlMigrationExample.ts] //// + +//// [tsconfig.json] +{ + "compilerOptions": { + "paths": { + // Explicit prefix for all path mappings + "@app/*": ["./src/app/*"], + "@lib/*": ["./src/lib/*"], + // Optional: preserve baseUrl behavior with catch-all + "*": ["./src/*"] + } + } +} + +//// [module.ts] +export const value = 42; + +//// [utils.ts] +export function helper() { return "help"; } + +//// [main.ts] +import { value } from "@app/module"; +import { helper } from "@lib/utils"; +// With explicit catch-all mapping, this still works: +import * as something from "someModule"; // Resolves to ./src/someModule + +//// [someModule.ts] +export const data = "from explicit path mapping"; +//// [module.ts] +export const value = 42; + +//// [utils.ts] +export function helper() { return "help"; } + +//// [main.ts] +import { value } from "@app/module"; +import { helper } from "@lib/utils"; +// This would also resolve due to baseUrl: +import * as something from "someModule"; // Resolves to ./src/someModule + +//// [someModule.ts] +export const data = "from baseUrl resolution"; + + +//// [module.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.value = void 0; +exports.value = 42; +//// [utils.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.helper = helper; +function helper() { return "help"; } +//// [someModule.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.data = void 0; +exports.data = "from baseUrl resolution"; +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/baseUrlMigrationExample.symbols b/tests/baselines/reference/baseUrlMigrationExample.symbols new file mode 100644 index 0000000000000..e4f9434dd6743 --- /dev/null +++ b/tests/baselines/reference/baseUrlMigrationExample.symbols @@ -0,0 +1,25 @@ +//// [tests/cases/compiler/baseUrlMigrationExample.ts] //// + +=== /before/src/app/module.ts === +export const value = 42; +>value : Symbol(value, Decl(module.ts, 0, 12)) + +=== /before/src/lib/utils.ts === +export function helper() { return "help"; } +>helper : Symbol(helper, Decl(utils.ts, 0, 0)) + +=== /before/src/main.ts === +import { value } from "@app/module"; +>value : Symbol(value, Decl(main.ts, 0, 8)) + +import { helper } from "@lib/utils"; +>helper : Symbol(helper, Decl(main.ts, 1, 8)) + +// This would also resolve due to baseUrl: +import * as something from "someModule"; // Resolves to ./src/someModule +>something : Symbol(something, Decl(main.ts, 3, 6)) + +=== /before/src/someModule.ts === +export const data = "from baseUrl resolution"; +>data : Symbol(data, Decl(someModule.ts, 0, 12)) + diff --git a/tests/baselines/reference/baseUrlMigrationExample.types b/tests/baselines/reference/baseUrlMigrationExample.types new file mode 100644 index 0000000000000..d901735735182 --- /dev/null +++ b/tests/baselines/reference/baseUrlMigrationExample.types @@ -0,0 +1,37 @@ +//// [tests/cases/compiler/baseUrlMigrationExample.ts] //// + +=== /before/src/app/module.ts === +export const value = 42; +>value : 42 +> : ^^ +>42 : 42 +> : ^^ + +=== /before/src/lib/utils.ts === +export function helper() { return "help"; } +>helper : () => string +> : ^^^^^^^^^^^^ +>"help" : "help" +> : ^^^^^^ + +=== /before/src/main.ts === +import { value } from "@app/module"; +>value : 42 +> : ^^ + +import { helper } from "@lib/utils"; +>helper : () => string +> : ^^^^^^^^^^^^ + +// This would also resolve due to baseUrl: +import * as something from "someModule"; // Resolves to ./src/someModule +>something : typeof something +> : ^^^^^^^^^^^^^^^^ + +=== /before/src/someModule.ts === +export const data = "from baseUrl resolution"; +>data : "from baseUrl resolution" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>"from baseUrl resolution" : "from baseUrl resolution" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/cases/compiler/baseUrlMigrationExample.ts b/tests/cases/compiler/baseUrlMigrationExample.ts new file mode 100644 index 0000000000000..c7510ba0377be --- /dev/null +++ b/tests/cases/compiler/baseUrlMigrationExample.ts @@ -0,0 +1,56 @@ +// @typeScriptVersion: 6.0 +// Test showing the recommended migration from baseUrl to explicit path mappings + +// @filename: /before/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "@app/*": ["app/*"], + "@lib/*": ["lib/*"] + } + } +} + +// @filename: /before/src/app/module.ts +export const value = 42; + +// @filename: /before/src/lib/utils.ts +export function helper() { return "help"; } + +// @filename: /before/src/main.ts +import { value } from "@app/module"; +import { helper } from "@lib/utils"; +// This would also resolve due to baseUrl: +import * as something from "someModule"; // Resolves to ./src/someModule + +// @filename: /before/src/someModule.ts +export const data = "from baseUrl resolution"; + +// @filename: /after/tsconfig.json +{ + "compilerOptions": { + "paths": { + // Explicit prefix for all path mappings + "@app/*": ["./src/app/*"], + "@lib/*": ["./src/lib/*"], + // Optional: preserve baseUrl behavior with catch-all + "*": ["./src/*"] + } + } +} + +// @filename: /after/src/app/module.ts +export const value = 42; + +// @filename: /after/src/lib/utils.ts +export function helper() { return "help"; } + +// @filename: /after/src/main.ts +import { value } from "@app/module"; +import { helper } from "@lib/utils"; +// With explicit catch-all mapping, this still works: +import * as something from "someModule"; // Resolves to ./src/someModule + +// @filename: /after/src/someModule.ts +export const data = "from explicit path mapping"; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts index ac4d51bacf50d..e2d56045a3534 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts @@ -1,18 +1,19 @@ -// @module: commonjs -// @traceResolution: true - -// baseurl is defined in tsconfig.json -// paths has errors - -// @filename: root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": "./src", - "paths": { - "*1*": [ "*2*" ] - } - } -} - -// @filename: root/src/folder1/file1.ts +// @module: commonjs +// @traceResolution: true + +// baseurl is defined in tsconfig.json +// paths has errors + +// @filename: root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "./src", + "ignoreDeprecations": "6.0", + "paths": { + "*1*": [ "*2*" ] + } + } +} + +// @filename: root/src/folder1/file1.ts export var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts index e302ca0addc78..cad08906c4f6e 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts @@ -1,28 +1,29 @@ -// @moduleResolution: bundler -// @module: commonjs -// @traceResolution: true - -// baseUrl set via command line - -// @filename: c:/root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": "." - } -} - -// @filename: c:/root/folder1/file1.ts -import {x} from "folder2/file2" -declare function use(a: any): void; -use(x.toExponential()); - -// @filename: c:/root/folder2/file2.ts -import {x as a} from "./file3" // found with baseurl -import {y as b} from "file4" // found with fallback -export var x = a + b; - -// @filename: c:/root/folder2/file3.ts -export var x = 1; - -// @filename: c:/node_modules/file4/index.d.ts +// @moduleResolution: bundler +// @module: commonjs +// @traceResolution: true + +// baseUrl set via command line + +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0" + } +} + +// @filename: c:/root/folder1/file1.ts +import {x} from "folder2/file2" +declare function use(a: any): void; +use(x.toExponential()); + +// @filename: c:/root/folder2/file2.ts +import {x as a} from "./file3" // found with baseurl +import {y as b} from "file4" // found with fallback +export var x = a + b; + +// @filename: c:/root/folder2/file3.ts +export var x = 1; + +// @filename: c:/node_modules/file4/index.d.ts export var y: number; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts index 9779f0ca64494..8b0599bfc13d9 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts @@ -1,43 +1,44 @@ -// @module: amd -// @traceResolution: true - -// paths is defined in tsconfig.json -// @filename: c:/root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": [ - "*", - "generated/*" - ], - "components/*": [ - "shared/components/*" - ] - } - } -} -// @filename: c:/root/folder1/file1.ts -import {x} from "folder2/file1" -import {y} from "folder3/file2" -import {z} from "components/file3" -import {z1} from "file4" - -declare function use(a: any): void; - -use(x.toExponential()); -use(y.toExponential()); -use(z.toExponential()); -use(z1.toExponential()); - -// @filename: c:/root/folder2/file1.ts -export var x = 1; - -// @filename: c:/root/generated/folder3/file2.ts -export var y = 1; - -// @filename: c:/root/shared/components/file3.ts -export var z = 1; - -// @filename: c:/file4.ts +// @module: amd +// @traceResolution: true + +// paths is defined in tsconfig.json +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": [ + "*", + "generated/*" + ], + "components/*": [ + "shared/components/*" + ] + } + } +} +// @filename: c:/root/folder1/file1.ts +import {x} from "folder2/file1" +import {y} from "folder3/file2" +import {z} from "components/file3" +import {z1} from "file4" + +declare function use(a: any): void; + +use(x.toExponential()); +use(y.toExponential()); +use(z.toExponential()); +use(z1.toExponential()); + +// @filename: c:/root/folder2/file1.ts +export var x = 1; + +// @filename: c:/root/generated/folder3/file2.ts +export var y = 1; + +// @filename: c:/root/shared/components/file3.ts +export var z = 1; + +// @filename: c:/file4.ts export var z1 = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts index ddc8e0e492595..98e9fa2ecff60 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts @@ -1,43 +1,44 @@ -// @module: commonjs -// @traceResolution: true - -// paths is defined in tsconfig.json -// @filename: c:/root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": [ - "*", - "generated/*" - ], - "components/*": [ - "shared/components/*" - ] - } - } -} -// @filename: c:/root/folder1/file1.ts -import {x} from "folder2/file1" -import {y} from "folder3/file2" -import {z} from "components/file3" -import {z1} from "file4" - -declare function use(a: any): void; - -use(x.toExponential()); -use(y.toExponential()); -use(z.toExponential()); -use(z1.toExponential()); - -// @filename: c:/root/folder2/file1.ts -export var x = 1; - -// @filename: c:/root/generated/folder3/file2.ts -export var y = 1; - -// @filename: c:/root/shared/components/file3/index.d.ts -export var z: number; - -// @filename: c:/node_modules/file4.ts -export var z1 = 1; +// @module: commonjs +// @traceResolution: true + +// paths is defined in tsconfig.json +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": [ + "*", + "generated/*" + ], + "components/*": [ + "shared/components/*" + ] + } + } +} +// @filename: c:/root/folder1/file1.ts +import {x} from "folder2/file1" +import {y} from "folder3/file2" +import {z} from "components/file3" +import {z1} from "file4" + +declare function use(a: any): void; + +use(x.toExponential()); +use(y.toExponential()); +use(z.toExponential()); +use(z1.toExponential()); + +// @filename: c:/root/folder2/file1.ts +export var x = 1; + +// @filename: c:/root/generated/folder3/file2.ts +export var y = 1; + +// @filename: c:/root/shared/components/file3/index.d.ts +export var z: number; + +// @filename: c:/node_modules/file4.ts +export var z1 = 1; diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts index 81c2328df670f..36769f4f9f2d0 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts @@ -1,49 +1,50 @@ -// @module: amd -// @traceResolution: true - -// @filename: c:/root/src/tsconfig.json -{ - "compilerOptions": { - "baseUrl": "../", - "paths": { - "*": [ - "*", - "c:/shared/*" - ], - "templates/*": [ - "generated/src/templates/*" - ] - }, - "rootDirs": [ - ".", - "../generated/src" - ] - } -} - -// @filename: c:/root/src/file1.ts -import {x} from "./project/file2"; -import {y} from "module3"; - -declare function use(x: string); -use(x.toFixed()); -use(y.toFixed()); - -// @filename: c:/root/generated/src/project/file2.ts -import {a} from "module1"; -import {b} from "templates/module2"; -import {x as c} from "../file3"; -export let x = a + b + c; - -// @filename: c:/shared/module1.d.ts -export let a: number - -// @filename: c:/root/generated/src/templates/module2.ts -export let b: number; - -// @filename: c:/root/src/file3.d.ts -export let x: number; - -// @filename: c:/module3.d.ts -export let y: number; - +// @module: amd +// @traceResolution: true + +// @filename: c:/root/src/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "../", + "ignoreDeprecations": "6.0", + "paths": { + "*": [ + "*", + "c:/shared/*" + ], + "templates/*": [ + "generated/src/templates/*" + ] + }, + "rootDirs": [ + ".", + "../generated/src" + ] + } +} + +// @filename: c:/root/src/file1.ts +import {x} from "./project/file2"; +import {y} from "module3"; + +declare function use(x: string); +use(x.toFixed()); +use(y.toFixed()); + +// @filename: c:/root/generated/src/project/file2.ts +import {a} from "module1"; +import {b} from "templates/module2"; +import {x as c} from "../file3"; +export let x = a + b + c; + +// @filename: c:/shared/module1.d.ts +export let a: number + +// @filename: c:/root/generated/src/templates/module2.ts +export let b: number; + +// @filename: c:/root/src/file3.d.ts +export let x: number; + +// @filename: c:/module3.d.ts +export let y: number; + diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts index 1ba9630e0cfab..4a60418651f3d 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts @@ -1,49 +1,50 @@ -// @module: commonjs -// @traceResolution: true - -// @filename: c:/root/src/tsconfig.json -{ - "compilerOptions": { - "baseUrl": "../", - "paths": { - "*": [ - "*", - "c:/shared/*" - ], - "templates/*": [ - "generated/src/templates/*" - ] - }, - "rootDirs": [ - ".", - "../generated/src" - ] - } -} - -// @filename: c:/root/src/file1.ts -import {x} from "./project/file2"; -import {y} from "module3"; - -declare function use(x: string); -use(x.toFixed()); -use(y.toFixed()); - -// @filename: c:/root/generated/src/project/file2.ts -import {a} from "module1"; -import {b} from "templates/module2"; -import {x as c} from "../file3"; -export let x = a + b + c; - -// @filename: c:/shared/module1/index.d.ts -export let a: number - -// @filename: c:/root/generated/src/templates/module2.ts -export let b: number; - -// @filename: c:/root/src/file3/index.d.ts -export let x: number; - -// @filename: c:/node_modules/module3.d.ts -export let y: number; - +// @module: commonjs +// @traceResolution: true + +// @filename: c:/root/src/tsconfig.json +{ + "compilerOptions": { + "baseUrl": "../", + "ignoreDeprecations": "6.0", + "paths": { + "*": [ + "*", + "c:/shared/*" + ], + "templates/*": [ + "generated/src/templates/*" + ] + }, + "rootDirs": [ + ".", + "../generated/src" + ] + } +} + +// @filename: c:/root/src/file1.ts +import {x} from "./project/file2"; +import {y} from "module3"; + +declare function use(x: string); +use(x.toFixed()); +use(y.toFixed()); + +// @filename: c:/root/generated/src/project/file2.ts +import {a} from "module1"; +import {b} from "templates/module2"; +import {x as c} from "../file3"; +export let x = a + b + c; + +// @filename: c:/shared/module1/index.d.ts +export let a: number + +// @filename: c:/root/generated/src/templates/module2.ts +export let b: number; + +// @filename: c:/root/src/file3/index.d.ts +export let x: number; + +// @filename: c:/node_modules/module3.d.ts +export let y: number; + diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution8_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution8_classic.ts index dbbf84ab91bcc..c871c41658271 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution8_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution8_classic.ts @@ -1,21 +1,22 @@ -// @moduleResolution: classic -// @module: amd -// @traceResolution: true - -// @filename: c:/root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "@speedy/*/testing": [ - "*/dist/index.ts" - ] - } - } -} - -// @filename: c:/root/index.ts -import {x} from "@speedy/folder1/testing" - -// @filename: c:/root/folder1/dist/index.ts -export const x = 1 + 2; +// @moduleResolution: classic +// @module: amd +// @traceResolution: true + +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "@speedy/*/testing": [ + "*/dist/index.ts" + ] + } + } +} + +// @filename: c:/root/index.ts +import {x} from "@speedy/folder1/testing" + +// @filename: c:/root/folder1/dist/index.ts +export const x = 1 + 2; diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution8_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution8_node.ts index 5cf3b61bb44e9..0bb308f36bf45 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution8_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution8_node.ts @@ -1,21 +1,22 @@ -// @moduleResolution: bundler -// @module: commonjs -// @traceResolution: true - -// @filename: c:/root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "@speedy/*/testing": [ - "*/dist/index.ts" - ] - } - } -} - -// @filename: c:/root/index.ts -import {x} from "@speedy/folder1/testing" - -// @filename: c:/root/folder1/dist/index.ts -export const x = 1 + 2; +// @moduleResolution: bundler +// @module: commonjs +// @traceResolution: true + +// @filename: c:/root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "@speedy/*/testing": [ + "*/dist/index.ts" + ] + } + } +} + +// @filename: c:/root/index.ts +import {x} from "@speedy/folder1/testing" + +// @filename: c:/root/folder1/dist/index.ts +export const x = 1 + 2; diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot.ts index 9af12c71a9547..6af7065721d76 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot.ts @@ -1,25 +1,26 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true - -// @filename: /root/src/foo.ts -export function foo() {} - -// @filename: /root/src/bar.js -export function bar() {} - -// @filename: /root/a.ts -import { foo } from "/foo"; -import { bar } from "/bar"; - -// @filename: /root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "/*": ["./src/*"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true + +// @filename: /root/src/foo.ts +export function foo() {} + +// @filename: /root/src/bar.js +export function bar() {} + +// @filename: /root/a.ts +import { foo } from "/foo"; +import { bar } from "/bar"; + +// @filename: /root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "/*": ["./src/*"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.ts index a9fd2cde5bd9a..fda6422a9f335 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.ts @@ -1,49 +1,50 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true - -// @filename: /root/src/foo.ts -export function foo() {} - -// @filename: /root/src/bar.js -export function bar() {} - -// @filename: /root/a.ts -import { foo as foo1 } from "/foo"; -import { bar as bar1 } from "/bar"; -import { foo as foo2 } from "c:/foo"; -import { bar as bar2 } from "c:/bar"; -import { foo as foo3 } from "c:\\foo"; -import { bar as bar3 } from "c:\\bar"; -import { foo as foo4 } from "//server/foo"; -import { bar as bar4 } from "//server/bar"; -import { foo as foo5 } from "\\\\server\\foo"; -import { bar as bar5 } from "\\\\server\\bar"; -import { foo as foo6 } from "file:///foo"; -import { bar as bar6 } from "file:///bar"; -import { foo as foo7 } from "file://c:/foo"; -import { bar as bar7 } from "file://c:/bar"; -import { foo as foo8 } from "file://server/foo"; -import { bar as bar8 } from "file://server/bar"; -import { foo as foo9 } from "http://server/foo"; -import { bar as bar9 } from "http://server/bar"; - -// @filename: /root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "/*": ["./src/*"], - "c:/*": ["./src/*"], - "c:\\*": ["./src/*"], - "//server/*": ["./src/*"], - "\\\\server\\*": ["./src/*"], - "file:///*": ["./src/*"], - "file://c:/*": ["./src/*"], - "file://server/*": ["./src/*"], - "http://server/*": ["./src/*"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true + +// @filename: /root/src/foo.ts +export function foo() {} + +// @filename: /root/src/bar.js +export function bar() {} + +// @filename: /root/a.ts +import { foo as foo1 } from "/foo"; +import { bar as bar1 } from "/bar"; +import { foo as foo2 } from "c:/foo"; +import { bar as bar2 } from "c:/bar"; +import { foo as foo3 } from "c:\\foo"; +import { bar as bar3 } from "c:\\bar"; +import { foo as foo4 } from "//server/foo"; +import { bar as bar4 } from "//server/bar"; +import { foo as foo5 } from "\\\\server\\foo"; +import { bar as bar5 } from "\\\\server\\bar"; +import { foo as foo6 } from "file:///foo"; +import { bar as bar6 } from "file:///bar"; +import { foo as foo7 } from "file://c:/foo"; +import { bar as bar7 } from "file://c:/bar"; +import { foo as foo8 } from "file://server/foo"; +import { bar as bar8 } from "file://server/bar"; +import { foo as foo9 } from "http://server/foo"; +import { bar as bar9 } from "http://server/bar"; + +// @filename: /root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "/*": ["./src/*"], + "c:/*": ["./src/*"], + "c:\\*": ["./src/*"], + "//server/*": ["./src/*"], + "\\\\server\\*": ["./src/*"], + "file:///*": ["./src/*"], + "file://c:/*": ["./src/*"], + "file://server/*": ["./src/*"], + "http://server/*": ["./src/*"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_multipleAliases.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_multipleAliases.ts index 5225f1dbd0561..75e9e3d1ed0a1 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_multipleAliases.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_multipleAliases.ts @@ -1,26 +1,27 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true - -// @filename: /root/import/foo.ts -export function foo() {} - -// @filename: /root/client/bar.js -export function bar() {} - -// @filename: /root/src/a.ts -import { foo } from "/import/foo"; -import { bar } from "/client/bar"; - -// @filename: /root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "/client/*": ["./client/*"], - "/import/*": ["./import/*"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true + +// @filename: /root/import/foo.ts +export function foo() {} + +// @filename: /root/client/bar.js +export function bar() {} + +// @filename: /root/src/a.ts +import { foo } from "/import/foo"; +import { bar } from "/client/bar"; + +// @filename: /root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "/client/*": ["./client/*"], + "/import/*": ["./import/*"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.ts index e45a25b1e1142..3b09b7b8eae9a 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.ts @@ -1,25 +1,26 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true - -// @filename: /foo.ts -export function foo() {} - -// @filename: /bar.js -export function bar() {} - -// @filename: /root/a.ts -import { foo } from "/foo"; -import { bar } from "/bar"; - -// @filename: /root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "/*": ["./src/*"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true + +// @filename: /foo.ts +export function foo() {} + +// @filename: /bar.js +export function bar() {} + +// @filename: /root/a.ts +import { foo } from "/foo"; +import { bar } from "/bar"; + +// @filename: /root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "/*": ["./src/*"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.ts index d05ea12b257b0..17e2b4fa45f74 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.ts @@ -1,25 +1,26 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true - -// @filename: /root/src/foo.ts -export function foo() {} - -// @filename: /root/src/bar.js -export function bar() {} - -// @filename: /root/a.ts -import { foo } from "/foo"; -import { bar } from "/bar"; - -// @filename: /root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": ["./src/*"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true + +// @filename: /root/src/foo.ts +export function foo() {} + +// @filename: /root/src/bar.js +export function bar() {} + +// @filename: /root/a.ts +import { foo } from "/foo"; +import { bar } from "/bar"; + +// @filename: /root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": ["./src/*"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.ts index eb552c73c8213..2f1999e007e1f 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.ts @@ -1,25 +1,26 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true - -// @filename: /foo.ts -export function foo() {} - -// @filename: /bar.js -export function bar() {} - -// @filename: /root/a.ts -import { foo } from "/foo"; -import { bar } from "/bar"; - -// @filename: /root/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": ["./src/*"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true + +// @filename: /foo.ts +export function foo() {} + +// @filename: /bar.js +export function bar() {} + +// @filename: /root/a.ts +import { foo } from "/foo"; +import { bar } from "/bar"; + +// @filename: /root/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": ["./src/*"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension.ts index e40c67e4ea38c..8d96d5229deab 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension.ts @@ -1,26 +1,27 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true - -// @Filename: /foo/foo.ts -export function foo() {} - -// @Filename: /bar/bar.js -export function bar() {} - -// @Filename: /a.ts -import { foo } from "foo"; -import { bar } from "bar"; - -// @Filename: /tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "foo": ["foo/foo.ts"], - "bar": ["bar/bar.js"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true + +// @Filename: /foo/foo.ts +export function foo() {} + +// @Filename: /bar/bar.js +export function bar() {} + +// @Filename: /a.ts +import { foo } from "foo"; +import { bar } from "bar"; + +// @Filename: /tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "foo": ["foo/foo.ts"], + "bar": ["bar/bar.js"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_withExtensionInName.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_withExtensionInName.ts index 675003fe142d5..fceab3d90ba9e 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_withExtensionInName.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_withExtensionInName.ts @@ -1,23 +1,24 @@ -// @traceResolution: true -// @module: commonjs -// @noImplicitReferences: true - -// @filename: /tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": ["foo/*"] - } - } -} - -// @filename: /foo/zone.js/index.d.ts -export const x: number; - -// @filename: /foo/zone.tsx/index.d.ts -export const y: number; - -// @filename: /a.ts -import { x } from "zone.js"; -import { y } from "zone.tsx"; +// @traceResolution: true +// @module: commonjs +// @noImplicitReferences: true + +// @filename: /tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": ["foo/*"] + } + } +} + +// @filename: /foo/zone.js/index.d.ts +export const x: number; + +// @filename: /foo/zone.tsx/index.d.ts +export const y: number; + +// @filename: /a.ts +import { x } from "zone.js"; +import { y } from "zone.tsx"; diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.ts index 99e4070ff8a8f..8671a98e05e3e 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.ts @@ -1,23 +1,24 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true -// @esModuleInterop: true -// @fullEmitPaths: true - -// @Filename: /node_modules/foo/bar/foobar.js -module.exports = { a: 10 }; - -// @Filename: /a.ts -import foobar from "foo/bar/foobar.js"; - -// @Filename: /tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": ["node_modules/*", "src/types"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true +// @esModuleInterop: true +// @fullEmitPaths: true + +// @Filename: /node_modules/foo/bar/foobar.js +module.exports = { a: 10 }; + +// @Filename: /a.ts +import foobar from "foo/bar/foobar.js"; + +// @Filename: /tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": ["node_modules/*", "src/types"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_failedLookup.ts b/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_failedLookup.ts index a983b6c482503..d38d788de7887 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_failedLookup.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution_withExtension_failedLookup.ts @@ -1,15 +1,16 @@ -// @noImplicitReferences: true -// @traceResolution: true - -// @Filename: /a.ts -import { foo } from "foo"; - -// @Filename: /tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "foo": ["foo/foo.ts"] - } - } -} +// @noImplicitReferences: true +// @traceResolution: true + +// @Filename: /a.ts +import { foo } from "foo"; + +// @Filename: /tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "foo": ["foo/foo.ts"] + } + } +} From 9ca4a616f6381c791ba2684e77e4ee14b8553a1e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:50:19 +0000 Subject: [PATCH 5/6] Fix remaining baseUrl tests to ignore deprecations Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> --- .../reference/pathMappingInheritedBaseUrl.js | 3 +- .../reference/pathsValidation1.errors.txt | 3 +- .../cases/compiler/amdModuleConstEnumUsage.ts | 33 +++--- .../declarationEmitMonorepoBaseUrl.ts | 3 +- .../declarationEmitPathMappingMonorepo.ts | 57 +++++----- .../declarationEmitPathMappingMonorepo2.ts | 87 +++++++-------- ...ationEmitPrefersPathKindBasedOnBundling.ts | 45 ++++---- ...tionEmitPrefersPathKindBasedOnBundling2.ts | 47 ++++---- ...ionPackageIdWithRelativeAndAbsolutePath.ts | 101 +++++++++--------- ...oduleResolutionWithExtensions_withPaths.ts | 81 +++++++------- ...thSuffixes_one_externalModule_withPaths.ts | 77 ++++++------- .../compiler/pathMappingInheritedBaseUrl.ts | 3 +- tests/cases/compiler/pathsValidation1.ts | 21 ++-- tests/cases/compiler/pathsValidation2.ts | 21 ++-- tests/cases/compiler/pathsValidation3.ts | 23 ++-- tests/cases/compiler/pathsValidation4.ts | 31 +++--- ...eWithoutResolveJsonModuleAndPathMapping.ts | 49 ++++----- .../compiler/requireOfJsonFile_PathMapping.ts | 49 ++++----- tests/cases/fourslash/autoImportPaths.ts | 3 +- .../fourslash/autoImportPathsNodeModules.ts | 1 + ...tionForStringLiteralNonrelativeImport11.ts | 1 + ...tionForStringLiteralNonrelativeImport14.ts | 1 + ...tionForStringLiteralNonrelativeImport15.ts | 1 + ...tionForStringLiteralNonrelativeImport16.ts | 1 + ...etionForStringLiteralNonrelativeImport7.ts | 1 + ...etionForStringLiteralNonrelativeImport8.ts | 1 + ...etionForStringLiteralNonrelativeImport9.ts | 1 + .../fourslash/completionsImportBaseUrl.ts | 1 + .../cases/fourslash/completionsPaths_kinds.ts | 1 + .../fourslash/completionsPaths_pathMapping.ts | 79 +++++++------- ...sPaths_pathMapping_nonTrailingWildcard1.ts | 1 + ...sPaths_pathMapping_notInNestedDirectory.ts | 1 + ...etionsPaths_pathMapping_parentDirectory.ts | 1 + ...mpletionsPaths_pathMapping_relativePath.ts | 1 + .../completionsPaths_pathMapping_topLevel.ts | 1 + .../getEditsForFileRename_tsconfig.ts | 2 + ...ForFileRename_unaffectedNonRelativePath.ts | 3 +- .../importNameCodeFixNewImportBaseUrl0.ts | 39 +++---- .../importNameCodeFixNewImportBaseUrl1.ts | 3 +- .../importNameCodeFixNewImportBaseUrl2.ts | 3 +- .../importNameCodeFixNewImportPaths0.ts | 45 ++++---- .../importNameCodeFixNewImportPaths1.ts | 45 ++++---- .../importNameCodeFixNewImportPaths2.ts | 57 +++++----- ...NameCodeFixNewImportPaths_withExtension.ts | 1 + ...deFixNewImportPaths_withLeadingDotSlash.ts | 1 + ...ixNewImportPaths_withParentRelativePath.ts | 1 + .../importNameCodeFixNewImportTypeRoots1.ts | 1 + .../importNameCodeFix_barrelExport2.ts | 1 + .../importNameCodeFix_fromPathMapping.ts | 1 + .../fourslash/importNameCodeFix_rootDirs.ts | 47 ++++---- .../moveToNewFile_nonRelativePaths.ts | 3 +- 51 files changed, 568 insertions(+), 516 deletions(-) diff --git a/tests/baselines/reference/pathMappingInheritedBaseUrl.js b/tests/baselines/reference/pathMappingInheritedBaseUrl.js index e82103b796154..6bb741ed9f915 100644 --- a/tests/baselines/reference/pathMappingInheritedBaseUrl.js +++ b/tests/baselines/reference/pathMappingInheritedBaseUrl.js @@ -3,7 +3,8 @@ //// [tsconfig.base.json] { "compilerOptions": { - "baseUrl": "." + "baseUrl": ".", + "ignoreDeprecations": "6.0" } } diff --git a/tests/baselines/reference/pathsValidation1.errors.txt b/tests/baselines/reference/pathsValidation1.errors.txt index 2c6784d00d715..4e6d6b96a485d 100644 --- a/tests/baselines/reference/pathsValidation1.errors.txt +++ b/tests/baselines/reference/pathsValidation1.errors.txt @@ -1,10 +1,11 @@ -tsconfig.json(5,18): error TS5063: Substitutions for pattern '*' should be an array. +tsconfig.json(6,18): error TS5063: Substitutions for pattern '*' should be an array. ==== tsconfig.json (1 errors) ==== { "compilerOptions": { "baseUrl": ".", + "ignoreDeprecations": "6.0", "paths": { "*": "*" ~~~ diff --git a/tests/cases/compiler/amdModuleConstEnumUsage.ts b/tests/cases/compiler/amdModuleConstEnumUsage.ts index 6778aee0cdd5c..58ee2eb490769 100644 --- a/tests/cases/compiler/amdModuleConstEnumUsage.ts +++ b/tests/cases/compiler/amdModuleConstEnumUsage.ts @@ -1,16 +1,17 @@ -// @module: amd -// @preserveConstEnums: true -// @baseUrl: /proj -// @filename: /proj/defs/cc.ts -export const enum CharCode { - A, - B -} -// @filename: /proj/component/file.ts - -import { CharCode } from 'defs/cc'; -export class User { - method(input: number) { - if (CharCode.A === input) {} - } -} +// @module: amd +// @preserveConstEnums: true +// @baseUrl: /proj +// @ignoreDeprecations: 6.0 +// @filename: /proj/defs/cc.ts +export const enum CharCode { + A, + B +} +// @filename: /proj/component/file.ts + +import { CharCode } from 'defs/cc'; +export class User { + method(input: number) { + if (CharCode.A === input) {} + } +} diff --git a/tests/cases/compiler/declarationEmitMonorepoBaseUrl.ts b/tests/cases/compiler/declarationEmitMonorepoBaseUrl.ts index 6c661f33939a4..41f0f1ffc2758 100644 --- a/tests/cases/compiler/declarationEmitMonorepoBaseUrl.ts +++ b/tests/cases/compiler/declarationEmitMonorepoBaseUrl.ts @@ -6,7 +6,8 @@ "module": "nodenext", "declaration": true, "outDir": "temp", - "baseUrl": "." + "baseUrl": ".", + "ignoreDeprecations": "6.0" } } diff --git a/tests/cases/compiler/declarationEmitPathMappingMonorepo.ts b/tests/cases/compiler/declarationEmitPathMappingMonorepo.ts index ea392197ba401..cbba963e5f94b 100644 --- a/tests/cases/compiler/declarationEmitPathMappingMonorepo.ts +++ b/tests/cases/compiler/declarationEmitPathMappingMonorepo.ts @@ -1,28 +1,29 @@ -// @filename: packages/a/index.d.ts -declare module "@ts-bug/a" { - export type AText = { - value: string; - }; - export function a(text: string): AText; - } - -// @filename: packages/b/src/index.ts -import { a } from "@ts-bug/a"; - -export function b(text: string) { - return a(text); -} -// @filename: packages/b/tsconfig.json -{ - "compilerOptions": { - "outDir": "dist", - "declaration": true, - "baseUrl": ".", - "paths": { - "@ts-bug/a": ["../a"] - } - } -} - -// @link: packages/a -> node_modules/@ts-bug/a -// @link: packages/b -> node_modules/@ts-bug/b +// @filename: packages/a/index.d.ts +declare module "@ts-bug/a" { + export type AText = { + value: string; + }; + export function a(text: string): AText; + } + +// @filename: packages/b/src/index.ts +import { a } from "@ts-bug/a"; + +export function b(text: string) { + return a(text); +} +// @filename: packages/b/tsconfig.json +{ + "compilerOptions": { + "outDir": "dist", + "declaration": true, + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "@ts-bug/a": ["../a"] + } + } +} + +// @link: packages/a -> node_modules/@ts-bug/a +// @link: packages/b -> node_modules/@ts-bug/b diff --git a/tests/cases/compiler/declarationEmitPathMappingMonorepo2.ts b/tests/cases/compiler/declarationEmitPathMappingMonorepo2.ts index aab1a00e143ec..0e36fd8d36b5c 100644 --- a/tests/cases/compiler/declarationEmitPathMappingMonorepo2.ts +++ b/tests/cases/compiler/declarationEmitPathMappingMonorepo2.ts @@ -1,44 +1,45 @@ -// @filename: packages/core/src/index.d.ts -export * from "./utils"; -export { default as SvgIcon } from "./SvgIcon"; - -// @filename: packages/core/src/SvgIcon.d.ts -import { StyledComponentProps } from "@ts-bug/styles"; -export interface SvgIconProps extends StyledComponentProps<"root"> { - children?: string[]; -} -export interface SomeInterface { - myProp: string; -} -declare const SvgIcon: SomeInterface; -export default SvgIcon; - -// @filename: packages/core/src/utils.d.ts -import SvgIcon from "./SvgIcon"; -export function createSvgIcon(path: string, displayName: string): typeof SvgIcon; - -// @filename: packages/styles/src/index.d.ts -export interface StyledComponentProps { - classes?: Record; -} - -// @filename: packages/lab/src/index.ts -import { createSvgIcon } from "@ts-bug/core/utils"; -export default createSvgIcon("Hello", "ArrowLeft"); - -// @filename: packages/lab/tsconfig.json -{ - "compilerOptions": { - "outDir": "dist", - "declaration": true, - "baseUrl": "../", - "paths": { - "@ts-bug/core": ["./core/src"], - "@ts-bug/core/*": ["./core/src/*"], - "@ts-bug/lab": ["./lab/src"], - "@ts-bug/lab/*": ["./lab/src/*"], - "@ts-bug/styles": ["./styles/src"], - "@ts-bug/styles/*": ["./styles/src/*"] - } - } +// @filename: packages/core/src/index.d.ts +export * from "./utils"; +export { default as SvgIcon } from "./SvgIcon"; + +// @filename: packages/core/src/SvgIcon.d.ts +import { StyledComponentProps } from "@ts-bug/styles"; +export interface SvgIconProps extends StyledComponentProps<"root"> { + children?: string[]; +} +export interface SomeInterface { + myProp: string; +} +declare const SvgIcon: SomeInterface; +export default SvgIcon; + +// @filename: packages/core/src/utils.d.ts +import SvgIcon from "./SvgIcon"; +export function createSvgIcon(path: string, displayName: string): typeof SvgIcon; + +// @filename: packages/styles/src/index.d.ts +export interface StyledComponentProps { + classes?: Record; +} + +// @filename: packages/lab/src/index.ts +import { createSvgIcon } from "@ts-bug/core/utils"; +export default createSvgIcon("Hello", "ArrowLeft"); + +// @filename: packages/lab/tsconfig.json +{ + "compilerOptions": { + "outDir": "dist", + "declaration": true, + "baseUrl": "../", + "ignoreDeprecations": "6.0", + "paths": { + "@ts-bug/core": ["./core/src"], + "@ts-bug/core/*": ["./core/src/*"], + "@ts-bug/lab": ["./lab/src"], + "@ts-bug/lab/*": ["./lab/src/*"], + "@ts-bug/styles": ["./styles/src"], + "@ts-bug/styles/*": ["./styles/src/*"] + } + } } \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmitPrefersPathKindBasedOnBundling.ts b/tests/cases/compiler/declarationEmitPrefersPathKindBasedOnBundling.ts index 4bb09d93c4486..c3d01c01cf19e 100644 --- a/tests/cases/compiler/declarationEmitPrefersPathKindBasedOnBundling.ts +++ b/tests/cases/compiler/declarationEmitPrefersPathKindBasedOnBundling.ts @@ -1,22 +1,23 @@ -// @declaration: true -// @target: es5 -// @baseUrl: . -// @outDir: ./dist -// @rootDir: ./src -// @filename: src/lib/operators/scalar.ts -export interface Scalar { - (): string; - value: number; -} - -export function scalar(value: string): Scalar { - return null as any; -} -// @filename: src/settings/spacing.ts -import { scalar } from '../lib/operators/scalar'; - -export default { - get xs() { - return scalar("14px"); - } -}; +// @declaration: true +// @target: es5 +// @baseUrl: . +// @ignoreDeprecations: 6.0 +// @outDir: ./dist +// @rootDir: ./src +// @filename: src/lib/operators/scalar.ts +export interface Scalar { + (): string; + value: number; +} + +export function scalar(value: string): Scalar { + return null as any; +} +// @filename: src/settings/spacing.ts +import { scalar } from '../lib/operators/scalar'; + +export default { + get xs() { + return scalar("14px"); + } +}; diff --git a/tests/cases/compiler/declarationEmitPrefersPathKindBasedOnBundling2.ts b/tests/cases/compiler/declarationEmitPrefersPathKindBasedOnBundling2.ts index ad40e87fffe32..81819c528e09a 100644 --- a/tests/cases/compiler/declarationEmitPrefersPathKindBasedOnBundling2.ts +++ b/tests/cases/compiler/declarationEmitPrefersPathKindBasedOnBundling2.ts @@ -1,23 +1,24 @@ -// @declaration: true -// @target: es5 -// @baseUrl: . -// @module: amd -// @outFile: ./dist.js -// @rootDir: ./src -// @filename: src/lib/operators/scalar.ts -export interface Scalar { - (): string; - value: number; -} - -export function scalar(value: string): Scalar { - return null as any; -} -// @filename: src/settings/spacing.ts -import { scalar } from '../lib/operators/scalar'; - -export default { - get xs() { - return scalar("14px"); - } -}; +// @declaration: true +// @target: es5 +// @baseUrl: . +// @ignoreDeprecations: 6.0 +// @module: amd +// @outFile: ./dist.js +// @rootDir: ./src +// @filename: src/lib/operators/scalar.ts +export interface Scalar { + (): string; + value: number; +} + +export function scalar(value: string): Scalar { + return null as any; +} +// @filename: src/settings/spacing.ts +import { scalar } from '../lib/operators/scalar'; + +export default { + get xs() { + return scalar("14px"); + } +}; diff --git a/tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts b/tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts index acbde7b1c7b9f..1d7b46ea4ba22 100644 --- a/tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts +++ b/tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts @@ -1,51 +1,52 @@ -// @noImplicitReferences: true -// @fullEmitPaths: true -// @traceResolution: true -// @filename: /shared/node_modules/troublesome-lib/package.json -{ - "name": "troublesome-lib", - "version": "1.17.1" -} -// @filename: /shared/node_modules/troublesome-lib/lib/Compactable.d.ts -import { Option } from './Option'; -export class Compactable { - option: Option; -} -// @filename: /shared/node_modules/troublesome-lib/lib/Option.d.ts -export class Option { - someProperty: string; -} -// @filename: /shared/lib/app.d.ts -import { Option } from "troublesome-lib/lib/Option"; -export class SharedOption extends Option { } -export const makeSharedOption: () => SharedOption; -// @filename: /project/node_modules/anotherLib/index.d.ts -import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable -// @filename: /project/node_modules/troublesome-lib/package.json -{ - "name": "troublesome-lib", - "version": "1.17.1" -} -// @filename: /project/node_modules/troublesome-lib/lib/Compactable.d.ts -import { Option } from './Option'; -export class Compactable { - option: Option; -} -// @filename: /project/node_modules/troublesome-lib/lib/Option.d.ts -export class Option { - someProperty: string; -} -// @filename: /project/src/app.ts -import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory -import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder - -// @filename: /project/tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "@shared/*": ["../shared/*"] - } - }, - //"files": ["src/app.ts"] +// @noImplicitReferences: true +// @fullEmitPaths: true +// @traceResolution: true +// @filename: /shared/node_modules/troublesome-lib/package.json +{ + "name": "troublesome-lib", + "version": "1.17.1" +} +// @filename: /shared/node_modules/troublesome-lib/lib/Compactable.d.ts +import { Option } from './Option'; +export class Compactable { + option: Option; +} +// @filename: /shared/node_modules/troublesome-lib/lib/Option.d.ts +export class Option { + someProperty: string; +} +// @filename: /shared/lib/app.d.ts +import { Option } from "troublesome-lib/lib/Option"; +export class SharedOption extends Option { } +export const makeSharedOption: () => SharedOption; +// @filename: /project/node_modules/anotherLib/index.d.ts +import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable +// @filename: /project/node_modules/troublesome-lib/package.json +{ + "name": "troublesome-lib", + "version": "1.17.1" +} +// @filename: /project/node_modules/troublesome-lib/lib/Compactable.d.ts +import { Option } from './Option'; +export class Compactable { + option: Option; +} +// @filename: /project/node_modules/troublesome-lib/lib/Option.d.ts +export class Option { + someProperty: string; +} +// @filename: /project/src/app.ts +import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory +import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder + +// @filename: /project/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "@shared/*": ["../shared/*"] + } + }, + //"files": ["src/app.ts"] } \ No newline at end of file diff --git a/tests/cases/compiler/moduleResolutionWithExtensions_withPaths.ts b/tests/cases/compiler/moduleResolutionWithExtensions_withPaths.ts index 3049c876affa3..3bced1fcc954b 100644 --- a/tests/cases/compiler/moduleResolutionWithExtensions_withPaths.ts +++ b/tests/cases/compiler/moduleResolutionWithExtensions_withPaths.ts @@ -1,40 +1,41 @@ -// @filename: /tsconfig.json -{ - "compilerOptions": { - "outDir": "lib", - "target": "ES6", - "module": "ES6", - "baseUrl": "/", - "moduleResolution": "Node", - "noImplicitAny": true, - "traceResolution": true, - "paths": { - "foo/*": ["node_modules/foo/lib/*"] - } - } -} - -// @filename: /node_modules/foo/lib/test.js -export function test() { - console.log("test"); -} - -// @filename: /node_modules/foo/lib/test.d.ts -export declare function test(): void; - -// @filename: /relative.js -export function relative() { - console.log("test"); -} - -// @filename: /relative.d.ts -export declare function relative(): void; - - -// @filename: /test.ts -import { test } from "foo/test.js"; -import { test as test2 } from "foo/test"; -import { relative } from "./relative.js"; -import { relative as relative2 } from "./relative"; - - +// @filename: /tsconfig.json +{ + "compilerOptions": { + "outDir": "lib", + "target": "ES6", + "module": "ES6", + "baseUrl": "/", + "ignoreDeprecations": "6.0", + "moduleResolution": "Node", + "noImplicitAny": true, + "traceResolution": true, + "paths": { + "foo/*": ["node_modules/foo/lib/*"] + } + } +} + +// @filename: /node_modules/foo/lib/test.js +export function test() { + console.log("test"); +} + +// @filename: /node_modules/foo/lib/test.d.ts +export declare function test(): void; + +// @filename: /relative.js +export function relative() { + console.log("test"); +} + +// @filename: /relative.d.ts +export declare function relative(): void; + + +// @filename: /test.ts +import { test } from "foo/test.js"; +import { test as test2 } from "foo/test"; +import { relative } from "./relative.js"; +import { relative as relative2 } from "./relative"; + + diff --git a/tests/cases/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.ts b/tests/cases/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.ts index 2abb86f20eb7c..5051da1811197 100644 --- a/tests/cases/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.ts +++ b/tests/cases/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.ts @@ -1,38 +1,39 @@ -// moduleSuffixes has one entry and there's a matching package. use the 'paths' option to map the package. -// @fullEmitPaths: true -// @filename: /tsconfig.json -{ - "compilerOptions": { - "allowJs": true, - "checkJs": false, - "outDir": "bin", - "moduleResolution": "node", - "traceResolution": true, - "moduleSuffixes": [".ios"], - "baseUrl": "/", - "paths": { - "some-library": ["node_modules/some-library/lib"], - "some-library/*": ["node_modules/some-library/lib/*"] - } - } -} - -// @filename: /node_modules/some-library/lib/index.ios.js -"use strict"; -exports.__esModule = true; -function ios() {} -exports.ios = ios; -// @filename: /node_modules/some-library/lib/index.ios.d.ts -export declare function ios(): void; -// @filename: /node_modules/some-library/lib/index.js -"use strict"; -exports.__esModule = true; -function base() {} -exports.base = base; -// @filename: /node_modules/some-library/lib/index.d.ts -export declare function base(): void; - -// @filename: /test.ts -import { ios } from "some-library"; -import { ios as ios2 } from "some-library/index"; -import { ios as ios3 } from "some-library/index.js"; +// moduleSuffixes has one entry and there's a matching package. use the 'paths' option to map the package. +// @fullEmitPaths: true +// @filename: /tsconfig.json +{ + "compilerOptions": { + "allowJs": true, + "checkJs": false, + "outDir": "bin", + "moduleResolution": "node", + "traceResolution": true, + "moduleSuffixes": [".ios"], + "baseUrl": "/", + "ignoreDeprecations": "6.0", + "paths": { + "some-library": ["node_modules/some-library/lib"], + "some-library/*": ["node_modules/some-library/lib/*"] + } + } +} + +// @filename: /node_modules/some-library/lib/index.ios.js +"use strict"; +exports.__esModule = true; +function ios() {} +exports.ios = ios; +// @filename: /node_modules/some-library/lib/index.ios.d.ts +export declare function ios(): void; +// @filename: /node_modules/some-library/lib/index.js +"use strict"; +exports.__esModule = true; +function base() {} +exports.base = base; +// @filename: /node_modules/some-library/lib/index.d.ts +export declare function base(): void; + +// @filename: /test.ts +import { ios } from "some-library"; +import { ios as ios2 } from "some-library/index"; +import { ios as ios3 } from "some-library/index.js"; diff --git a/tests/cases/compiler/pathMappingInheritedBaseUrl.ts b/tests/cases/compiler/pathMappingInheritedBaseUrl.ts index a662062894d5d..c4a0867beb7f6 100644 --- a/tests/cases/compiler/pathMappingInheritedBaseUrl.ts +++ b/tests/cases/compiler/pathMappingInheritedBaseUrl.ts @@ -3,7 +3,8 @@ // @Filename: /other/tsconfig.base.json { "compilerOptions": { - "baseUrl": "." + "baseUrl": ".", + "ignoreDeprecations": "6.0" } } diff --git a/tests/cases/compiler/pathsValidation1.ts b/tests/cases/compiler/pathsValidation1.ts index 45a4409cf0392..781b45f3f744c 100644 --- a/tests/cases/compiler/pathsValidation1.ts +++ b/tests/cases/compiler/pathsValidation1.ts @@ -1,11 +1,12 @@ -// @filename: tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": "*" - } - } -} -// @filename: a.ts +// @filename: tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": "*" + } + } +} +// @filename: a.ts let x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathsValidation2.ts b/tests/cases/compiler/pathsValidation2.ts index b15ad4e236af4..bc0fa440adae8 100644 --- a/tests/cases/compiler/pathsValidation2.ts +++ b/tests/cases/compiler/pathsValidation2.ts @@ -1,11 +1,12 @@ -// @filename: tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": [1] - } - } -} -// @filename: a.ts +// @filename: tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": [1] + } + } +} +// @filename: a.ts let x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathsValidation3.ts b/tests/cases/compiler/pathsValidation3.ts index 28db959a881db..04852e53aa9c6 100644 --- a/tests/cases/compiler/pathsValidation3.ts +++ b/tests/cases/compiler/pathsValidation3.ts @@ -1,12 +1,13 @@ -// @filename: tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "foo": [] - } - } -} - -// @filename: a.ts +// @filename: tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "foo": [] + } + } +} + +// @filename: a.ts let x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/pathsValidation4.ts b/tests/cases/compiler/pathsValidation4.ts index fc9568c09e384..48645fc2f86ae 100644 --- a/tests/cases/compiler/pathsValidation4.ts +++ b/tests/cases/compiler/pathsValidation4.ts @@ -1,16 +1,17 @@ -// @noTypesAndSymbols: true -// @filename: tsconfig.json -{ - "compilerOptions": { - "traceResolution": true, - "baseUrl": "./src", - "paths": { - "@interface/**/*" : ["./src/interface/*"], - "@service/**/*": ["./src/service/**/*"], - "@controller/*": ["controller/*"], - } - } -} - -// @filename: src/main.ts +// @noTypesAndSymbols: true +// @filename: tsconfig.json +{ + "compilerOptions": { + "traceResolution": true, + "baseUrl": "./src", + "ignoreDeprecations": "6.0", + "paths": { + "@interface/**/*" : ["./src/interface/*"], + "@service/**/*": ["./src/service/**/*"], + "@controller/*": ["controller/*"], + } + } +} + +// @filename: src/main.ts import 'someModule'; \ No newline at end of file diff --git a/tests/cases/compiler/requireOfJsonFileWithoutResolveJsonModuleAndPathMapping.ts b/tests/cases/compiler/requireOfJsonFileWithoutResolveJsonModuleAndPathMapping.ts index bd0e1eb16e154..e2508fae1651c 100644 --- a/tests/cases/compiler/requireOfJsonFileWithoutResolveJsonModuleAndPathMapping.ts +++ b/tests/cases/compiler/requireOfJsonFileWithoutResolveJsonModuleAndPathMapping.ts @@ -1,24 +1,25 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true -// @esModuleInterop: true -// @fullEmitPaths: true -// @resolveJsonModule: false - -// @Filename: /node_modules/foo/bar/foobar.json -{ "a": 10 } - -// @Filename: /a.ts -import foobar from "foo/bar/foobar.json"; - -// @Filename: /tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": ["node_modules/*", "src/types"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true +// @esModuleInterop: true +// @fullEmitPaths: true +// @resolveJsonModule: false + +// @Filename: /node_modules/foo/bar/foobar.json +{ "a": 10 } + +// @Filename: /a.ts +import foobar from "foo/bar/foobar.json"; + +// @Filename: /tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": ["node_modules/*", "src/types"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/compiler/requireOfJsonFile_PathMapping.ts b/tests/cases/compiler/requireOfJsonFile_PathMapping.ts index f61692ae83da1..6d091a01be0d7 100644 --- a/tests/cases/compiler/requireOfJsonFile_PathMapping.ts +++ b/tests/cases/compiler/requireOfJsonFile_PathMapping.ts @@ -1,24 +1,25 @@ -// @noImplicitReferences: true -// @traceResolution: true -// @allowJs: true -// @esModuleInterop: true -// @fullEmitPaths: true -// @resolveJsonModule: true - -// @Filename: /node_modules/foo/bar/foobar.json -{ "a": 10 } - -// @Filename: /a.ts -import foobar from "foo/bar/foobar.json"; - -// @Filename: /tsconfig.json -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": ["node_modules/*", "src/types"] - }, - "allowJs": true, - "outDir": "bin" - } -} +// @noImplicitReferences: true +// @traceResolution: true +// @allowJs: true +// @esModuleInterop: true +// @fullEmitPaths: true +// @resolveJsonModule: true + +// @Filename: /node_modules/foo/bar/foobar.json +{ "a": 10 } + +// @Filename: /a.ts +import foobar from "foo/bar/foobar.json"; + +// @Filename: /tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "ignoreDeprecations": "6.0", + "paths": { + "*": ["node_modules/*", "src/types"] + }, + "allowJs": true, + "outDir": "bin" + } +} diff --git a/tests/cases/fourslash/autoImportPaths.ts b/tests/cases/fourslash/autoImportPaths.ts index b09e84a3d38b4..feb70cd6032e9 100644 --- a/tests/cases/fourslash/autoImportPaths.ts +++ b/tests/cases/fourslash/autoImportPaths.ts @@ -8,7 +8,8 @@ //// "package1/*": ["./*"], //// "package2/*": ["../package2/*"] //// }, -//// "baseUrl": "." +//// "baseUrl": ".", + "ignoreDeprecations": "6.0" //// }, //// "include": [ //// ".", diff --git a/tests/cases/fourslash/autoImportPathsNodeModules.ts b/tests/cases/fourslash/autoImportPathsNodeModules.ts index 18df371fb1d05..cc753a0461b7a 100644 --- a/tests/cases/fourslash/autoImportPathsNodeModules.ts +++ b/tests/cases/fourslash/autoImportPathsNodeModules.ts @@ -7,6 +7,7 @@ //// "moduleResolution": "node", //// "rootDir": "ts", //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "paths": { //// "*": ["node_modules/@woltlab/wcf/ts/*"] //// } diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport11.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport11.ts index cbabf317cc3ee..76cd506c56ad0 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport11.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport11.ts @@ -3,6 +3,7 @@ // Should handle nested files in folders discovered via the baseUrl compiler option // @baseUrl: tests/cases/fourslash/modules +// @ignoreDeprecations: 6.0 // @Filename: tests/test0.ts //// import * as foo1 from "subfolder//*import_as0*/ diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts index e3bc4eccdc1f2..e90fa1b6a479b 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts @@ -6,6 +6,7 @@ //// { //// "compilerOptions": { //// "baseUrl": "./modules", + "ignoreDeprecations": "6.0", //// "paths": { //// "/module1": ["some/path/whatever.ts"], //// "/module2": ["some/other/path.ts"] diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport15.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport15.ts index 170fdd01be1fa..18e1deb7fa558 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport15.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport15.ts @@ -6,6 +6,7 @@ //// { //// "compilerOptions": { //// "baseUrl": "./modules", + "ignoreDeprecations": "6.0", //// "paths": { //// "/module1": ["some/path/whatever.ts"], //// "/module2": ["some/other/path.ts"] diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport16.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport16.ts index 0a01b6ed90449..c32e311a8974c 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport16.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport16.ts @@ -7,6 +7,7 @@ //// "compilerOptions": { //// "resolveJsonModule": false, //// "baseUrl": "./", + "ignoreDeprecations": "6.0", //// "paths": { //// "module1/path1": ["some/path/whatever.ts"], //// } diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport7.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport7.ts index fa144081001d1..1a4e879e76531 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport7.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport7.ts @@ -3,6 +3,7 @@ // Should give completions for files that are discovered via the baseUrl compiler option // @baseUrl: tests/cases/fourslash/modules +// @ignoreDeprecations: 6.0 // @Filename: tests/test0.ts //// import * as foo1 from "mod/*import_as0*/ diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport8.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport8.ts index 20bb304d125b4..07fde4df06c94 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport8.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport8.ts @@ -6,6 +6,7 @@ //// { //// "compilerOptions": { //// "baseUrl": "./modules", + "ignoreDeprecations": "6.0", //// "paths": { //// "*": [ //// "prefix/0*/suffix.ts", diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts index cdb08070db7c7..b1220cdf683c8 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts @@ -6,6 +6,7 @@ //// { //// "compilerOptions": { //// "baseUrl": "./modules", + "ignoreDeprecations": "6.0", //// "paths": { //// "module1": ["some/path/whatever.ts"], //// "module2": ["some/other/path.ts"] diff --git a/tests/cases/fourslash/completionsImportBaseUrl.ts b/tests/cases/fourslash/completionsImportBaseUrl.ts index 5f67a7d4d6301..5fe330b1d0b0a 100644 --- a/tests/cases/fourslash/completionsImportBaseUrl.ts +++ b/tests/cases/fourslash/completionsImportBaseUrl.ts @@ -4,6 +4,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "module": "esnext" //// } ////} diff --git a/tests/cases/fourslash/completionsPaths_kinds.ts b/tests/cases/fourslash/completionsPaths_kinds.ts index e986457f7a098..5b7615aa2b46c 100644 --- a/tests/cases/fourslash/completionsPaths_kinds.ts +++ b/tests/cases/fourslash/completionsPaths_kinds.ts @@ -14,6 +14,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "paths": { //// "foo/*": ["src/*"] //// } diff --git a/tests/cases/fourslash/completionsPaths_pathMapping.ts b/tests/cases/fourslash/completionsPaths_pathMapping.ts index 381fe5b7d38e0..e2a8f8e1e6b03 100644 --- a/tests/cases/fourslash/completionsPaths_pathMapping.ts +++ b/tests/cases/fourslash/completionsPaths_pathMapping.ts @@ -1,39 +1,40 @@ -/// - -// @Filename: /src/b.ts -////export const x = 0; - -// @Filename: /src/dir/x.ts -/////export const x = 0; - -// @Filename: /src/a.ts -////import {} from "foo//*0*/"; -////import {} from "foo/dir//*1*/"; - -// @Filename: /tsconfig.json -////{ -//// "compilerOptions": { -//// "baseUrl": ".", -//// "paths": { -//// "foo/*": ["src/*"] -//// } -//// } -////} - -const [r0, r1] = test.ranges(); -verify.completions( - { - marker: "0", - exact: [ - { name: "a", kind: "script", kindModifiers: ".ts" }, - { name: "b", kind: "script", kindModifiers: ".ts" }, - { name: "dir", kind: "directory" }, - ], - isNewIdentifierLocation: true, - }, - { - marker: "1", - exact: { name: "x", kind: "script", kindModifiers: ".ts" }, - isNewIdentifierLocation: true, - }, -); +/// + +// @Filename: /src/b.ts +////export const x = 0; + +// @Filename: /src/dir/x.ts +/////export const x = 0; + +// @Filename: /src/a.ts +////import {} from "foo//*0*/"; +////import {} from "foo/dir//*1*/"; + +// @Filename: /tsconfig.json +////{ +//// "compilerOptions": { +//// "baseUrl": ".", + "ignoreDeprecations": "6.0", +//// "paths": { +//// "foo/*": ["src/*"] +//// } +//// } +////} + +const [r0, r1] = test.ranges(); +verify.completions( + { + marker: "0", + exact: [ + { name: "a", kind: "script", kindModifiers: ".ts" }, + { name: "b", kind: "script", kindModifiers: ".ts" }, + { name: "dir", kind: "directory" }, + ], + isNewIdentifierLocation: true, + }, + { + marker: "1", + exact: { name: "x", kind: "script", kindModifiers: ".ts" }, + isNewIdentifierLocation: true, + }, +); diff --git a/tests/cases/fourslash/completionsPaths_pathMapping_nonTrailingWildcard1.ts b/tests/cases/fourslash/completionsPaths_pathMapping_nonTrailingWildcard1.ts index 65f8c7e59b5d7..acb82ecb37114 100644 --- a/tests/cases/fourslash/completionsPaths_pathMapping_nonTrailingWildcard1.ts +++ b/tests/cases/fourslash/completionsPaths_pathMapping_nonTrailingWildcard1.ts @@ -16,6 +16,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "paths": { //// "foo/_*/suffix": ["src/*.ts"] //// } diff --git a/tests/cases/fourslash/completionsPaths_pathMapping_notInNestedDirectory.ts b/tests/cases/fourslash/completionsPaths_pathMapping_notInNestedDirectory.ts index 0453e17ea2bf0..00c43140a0909 100644 --- a/tests/cases/fourslash/completionsPaths_pathMapping_notInNestedDirectory.ts +++ b/tests/cases/fourslash/completionsPaths_pathMapping_notInNestedDirectory.ts @@ -7,6 +7,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "paths": { //// "mapping/*": ["whatever"], //// } diff --git a/tests/cases/fourslash/completionsPaths_pathMapping_parentDirectory.ts b/tests/cases/fourslash/completionsPaths_pathMapping_parentDirectory.ts index c34f6e5db88ee..72b513c5916df 100644 --- a/tests/cases/fourslash/completionsPaths_pathMapping_parentDirectory.ts +++ b/tests/cases/fourslash/completionsPaths_pathMapping_parentDirectory.ts @@ -10,6 +10,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": "src", + "ignoreDeprecations": "6.0", //// "paths": { //// "foo/*": ["../oof/*"] //// } diff --git a/tests/cases/fourslash/completionsPaths_pathMapping_relativePath.ts b/tests/cases/fourslash/completionsPaths_pathMapping_relativePath.ts index 11fe02ffa7dda..74c48ca96e2cc 100644 --- a/tests/cases/fourslash/completionsPaths_pathMapping_relativePath.ts +++ b/tests/cases/fourslash/completionsPaths_pathMapping_relativePath.ts @@ -14,6 +14,7 @@ //// "compilerOptions": { //// "resolveJsonModule": false, //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "paths": { //// "foo/*": ["./*"] //// } diff --git a/tests/cases/fourslash/completionsPaths_pathMapping_topLevel.ts b/tests/cases/fourslash/completionsPaths_pathMapping_topLevel.ts index 88620434a49d6..7972922384ccb 100644 --- a/tests/cases/fourslash/completionsPaths_pathMapping_topLevel.ts +++ b/tests/cases/fourslash/completionsPaths_pathMapping_topLevel.ts @@ -8,6 +8,7 @@ //// "compilerOptions": { //// "resolveJsonModule": false, //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "paths": { //// "foo/*": ["src/*"] //// } diff --git a/tests/cases/fourslash/getEditsForFileRename_tsconfig.ts b/tests/cases/fourslash/getEditsForFileRename_tsconfig.ts index f64023eeb40b3..13c283b36e0c0 100644 --- a/tests/cases/fourslash/getEditsForFileRename_tsconfig.ts +++ b/tests/cases/fourslash/getEditsForFileRename_tsconfig.ts @@ -4,6 +4,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": "./old", + "ignoreDeprecations": "6.0", //// "paths": { //// "foo": ["old"], //// }, @@ -27,6 +28,7 @@ verify.getEditsForFileRename({ `{ "compilerOptions": { "baseUrl": "new", + "ignoreDeprecations": "6.0", "paths": { "foo": ["new"], }, diff --git a/tests/cases/fourslash/getEditsForFileRename_unaffectedNonRelativePath.ts b/tests/cases/fourslash/getEditsForFileRename_unaffectedNonRelativePath.ts index d2f9daeba3e19..5c8948546720c 100644 --- a/tests/cases/fourslash/getEditsForFileRename_unaffectedNonRelativePath.ts +++ b/tests/cases/fourslash/getEditsForFileRename_unaffectedNonRelativePath.ts @@ -9,7 +9,8 @@ // @Filename: /tsconfig.json ////{ //// "compilerOptions": { -//// "baseUrl": "." +//// "baseUrl": ".", + "ignoreDeprecations": "6.0" //// } ////} diff --git a/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl0.ts b/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl0.ts index c30bee2b993ab..31517e1c6d9ae 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl0.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl0.ts @@ -1,19 +1,20 @@ -/// - -//// [|f1/*0*/();|] - -// @Filename: tsconfig.json -//// { -//// "compilerOptions": { -//// "baseUrl": "./a" -//// } -//// } - -// @Filename: a/b.ts -//// export function f1() { }; - -verify.importFixAtPosition([ -`import { f1 } from "b"; - -f1();`, -]); +/// + +//// [|f1/*0*/();|] + +// @Filename: tsconfig.json +//// { +//// "compilerOptions": { +//// "baseUrl": "./a", + "ignoreDeprecations": "6.0" +//// } +//// } + +// @Filename: a/b.ts +//// export function f1() { }; + +verify.importFixAtPosition([ +`import { f1 } from "b"; + +f1();`, +]); diff --git a/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl1.ts b/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl1.ts index 285a2e6ff53e1..e2c095146dc72 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl1.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl1.ts @@ -3,7 +3,8 @@ // @Filename: /tsconfig.json ////{ //// "compilerOptions": { -//// "baseUrl": "./a" +//// "baseUrl": "./a", + "ignoreDeprecations": "6.0" //// } ////} diff --git a/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl2.ts b/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl2.ts index 1923251d10ef7..9da3c75520780 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl2.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportBaseUrl2.ts @@ -3,7 +3,8 @@ // @Filename: /tsconfig.json ////{ //// "compilerOptions": { -//// "baseUrl": "./a" +//// "baseUrl": "./a", + "ignoreDeprecations": "6.0" //// } ////} diff --git a/tests/cases/fourslash/importNameCodeFixNewImportPaths0.ts b/tests/cases/fourslash/importNameCodeFixNewImportPaths0.ts index bd3fd9a84b3f5..9a829a5418398 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportPaths0.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportPaths0.ts @@ -1,22 +1,23 @@ -/// - -//// [|foo/*0*/();|] - -// @Filename: folder_a/f2.ts -//// export function foo() {}; - -// @Filename: tsconfig.json -//// { -//// "compilerOptions": { -//// "baseUrl": ".", -//// "paths": { -//// "a": [ "folder_a/f2" ] -//// } -//// } -//// } - -verify.importFixAtPosition([ -`import { foo } from "a"; - -foo();` -]); +/// + +//// [|foo/*0*/();|] + +// @Filename: folder_a/f2.ts +//// export function foo() {}; + +// @Filename: tsconfig.json +//// { +//// "compilerOptions": { +//// "baseUrl": ".", + "ignoreDeprecations": "6.0", +//// "paths": { +//// "a": [ "folder_a/f2" ] +//// } +//// } +//// } + +verify.importFixAtPosition([ +`import { foo } from "a"; + +foo();` +]); diff --git a/tests/cases/fourslash/importNameCodeFixNewImportPaths1.ts b/tests/cases/fourslash/importNameCodeFixNewImportPaths1.ts index 5ac195e9ab468..981ed4966148e 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportPaths1.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportPaths1.ts @@ -1,22 +1,23 @@ -/// - -//// [|foo/*0*/();|] - -// @Filename: folder_b/f2.ts -//// export function foo() {}; - -// @Filename: tsconfig.json -//// { -//// "compilerOptions": { -//// "baseUrl": ".", -//// "paths": { -//// "b/*": [ "folder_b/*" ] -//// } -//// } -//// } - -verify.importFixAtPosition([ -`import { foo } from "b/f2"; - -foo();` -]); +/// + +//// [|foo/*0*/();|] + +// @Filename: folder_b/f2.ts +//// export function foo() {}; + +// @Filename: tsconfig.json +//// { +//// "compilerOptions": { +//// "baseUrl": ".", + "ignoreDeprecations": "6.0", +//// "paths": { +//// "b/*": [ "folder_b/*" ] +//// } +//// } +//// } + +verify.importFixAtPosition([ +`import { foo } from "b/f2"; + +foo();` +]); diff --git a/tests/cases/fourslash/importNameCodeFixNewImportPaths2.ts b/tests/cases/fourslash/importNameCodeFixNewImportPaths2.ts index 33b8d9330be71..379bcac51f488 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportPaths2.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportPaths2.ts @@ -1,28 +1,29 @@ -/// - -//// [|foo/*0*/();|] - -// @Filename: folder_b/index.ts -//// export function foo() {}; - -// @Filename: tsconfig.path.json -//// { -//// "compilerOptions": { -//// "baseUrl": ".", -//// "paths": { -//// "b": [ "folder_b/index" ] -//// } -//// } -//// } - -// @Filename: tsconfig.json -//// { -//// "extends": "./tsconfig.path", -//// "compilerOptions": { } -//// } - -verify.importFixAtPosition([ -`import { foo } from "b"; - -foo();` -]); +/// + +//// [|foo/*0*/();|] + +// @Filename: folder_b/index.ts +//// export function foo() {}; + +// @Filename: tsconfig.path.json +//// { +//// "compilerOptions": { +//// "baseUrl": ".", + "ignoreDeprecations": "6.0", +//// "paths": { +//// "b": [ "folder_b/index" ] +//// } +//// } +//// } + +// @Filename: tsconfig.json +//// { +//// "extends": "./tsconfig.path", +//// "compilerOptions": { } +//// } + +verify.importFixAtPosition([ +`import { foo } from "b"; + +foo();` +]); diff --git a/tests/cases/fourslash/importNameCodeFixNewImportPaths_withExtension.ts b/tests/cases/fourslash/importNameCodeFixNewImportPaths_withExtension.ts index c383b09862e2e..dfaa480b5367b 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportPaths_withExtension.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportPaths_withExtension.ts @@ -10,6 +10,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "paths": { //// "foo": ["src/thisHasPathMapping.ts"] //// } diff --git a/tests/cases/fourslash/importNameCodeFixNewImportPaths_withLeadingDotSlash.ts b/tests/cases/fourslash/importNameCodeFixNewImportPaths_withLeadingDotSlash.ts index f29932eed732b..3315870550bb9 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportPaths_withLeadingDotSlash.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportPaths_withLeadingDotSlash.ts @@ -10,6 +10,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "paths": { //// "foo": ["././thisHasPathMapping"] //// } diff --git a/tests/cases/fourslash/importNameCodeFixNewImportPaths_withParentRelativePath.ts b/tests/cases/fourslash/importNameCodeFixNewImportPaths_withParentRelativePath.ts index 4bd938ae0b97a..c6f6bd78f9385 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportPaths_withParentRelativePath.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportPaths_withParentRelativePath.ts @@ -10,6 +10,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": "src", + "ignoreDeprecations": "6.0", //// "paths": { //// "foo": ["..\\thisHasPathMapping"] //// } diff --git a/tests/cases/fourslash/importNameCodeFixNewImportTypeRoots1.ts b/tests/cases/fourslash/importNameCodeFixNewImportTypeRoots1.ts index f4aa86ca7d7e2..569e2b4d7be62 100644 --- a/tests/cases/fourslash/importNameCodeFixNewImportTypeRoots1.ts +++ b/tests/cases/fourslash/importNameCodeFixNewImportTypeRoots1.ts @@ -10,6 +10,7 @@ //// { //// "compilerOptions": { //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "typeRoots": [ //// "./types" //// ] diff --git a/tests/cases/fourslash/importNameCodeFix_barrelExport2.ts b/tests/cases/fourslash/importNameCodeFix_barrelExport2.ts index 97a2926ae1167..456ff436970e6 100644 --- a/tests/cases/fourslash/importNameCodeFix_barrelExport2.ts +++ b/tests/cases/fourslash/importNameCodeFix_barrelExport2.ts @@ -2,6 +2,7 @@ // @module: commonjs // @baseUrl: / +// @ignoreDeprecations: 6.0 // @Filename: /proj/foo/a.ts //// export const A = 0; diff --git a/tests/cases/fourslash/importNameCodeFix_fromPathMapping.ts b/tests/cases/fourslash/importNameCodeFix_fromPathMapping.ts index 4affd5e33ba67..0cd557ce1517d 100644 --- a/tests/cases/fourslash/importNameCodeFix_fromPathMapping.ts +++ b/tests/cases/fourslash/importNameCodeFix_fromPathMapping.ts @@ -10,6 +10,7 @@ ////{ //// "compilerOptions": { //// "baseUrl": ".", + "ignoreDeprecations": "6.0", //// "paths": { //// "@root/*": ["*"], //// } diff --git a/tests/cases/fourslash/importNameCodeFix_rootDirs.ts b/tests/cases/fourslash/importNameCodeFix_rootDirs.ts index 1367f53b9f3ec..fc01cc69ae49c 100644 --- a/tests/cases/fourslash/importNameCodeFix_rootDirs.ts +++ b/tests/cases/fourslash/importNameCodeFix_rootDirs.ts @@ -1,23 +1,24 @@ -/// - -// @Filename: /a.ts -////export const a = 0; - -// @Filename: /b.ts -////a; - -// @Filename: /tsconfig.json -////{ -//// "compilerOptions": { -//// "baseUrl": ".", -//// "rootDirs": ["."] -//// } -////} - -const nonRelative = 'import { a } from "a";\n\na;'; -const relative = nonRelative.replace('"a"', '"./a"'); - -goTo.file("/b.ts"); -verify.importFixAtPosition([nonRelative]); -verify.importFixAtPosition([nonRelative], undefined, { importModuleSpecifierPreference: "non-relative" }); -verify.importFixAtPosition([relative], undefined, { importModuleSpecifierPreference: "relative" }); +/// + +// @Filename: /a.ts +////export const a = 0; + +// @Filename: /b.ts +////a; + +// @Filename: /tsconfig.json +////{ +//// "compilerOptions": { +//// "baseUrl": ".", + "ignoreDeprecations": "6.0", +//// "rootDirs": ["."] +//// } +////} + +const nonRelative = 'import { a } from "a";\n\na;'; +const relative = nonRelative.replace('"a"', '"./a"'); + +goTo.file("/b.ts"); +verify.importFixAtPosition([nonRelative]); +verify.importFixAtPosition([nonRelative], undefined, { importModuleSpecifierPreference: "non-relative" }); +verify.importFixAtPosition([relative], undefined, { importModuleSpecifierPreference: "relative" }); diff --git a/tests/cases/fourslash/moveToNewFile_nonRelativePaths.ts b/tests/cases/fourslash/moveToNewFile_nonRelativePaths.ts index 9d3af58c8807c..1665cbb546ecf 100644 --- a/tests/cases/fourslash/moveToNewFile_nonRelativePaths.ts +++ b/tests/cases/fourslash/moveToNewFile_nonRelativePaths.ts @@ -4,7 +4,8 @@ //// { //// "compilerOptions": { //// "moduleResolution": "Bundler", -//// "baseUrl": "." +//// "baseUrl": ".", + "ignoreDeprecations": "6.0" //// "paths": { //// "@foo/*": ["src/*"] //// } From f4eab52f19f2313ceee455931a93597552b306f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:58:09 +0000 Subject: [PATCH 6/6] Complete baseUrl deprecation implementation for TypeScript 6.0 Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> --- .../conformance/moduleResolution/typesVersions.emptyTypes.ts | 3 ++- .../conformance/moduleResolution/typesVersions.justIndex.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts b/tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts index f5d0792bfc438..6603f5972da1d 100644 --- a/tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts +++ b/tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts @@ -1,4 +1,5 @@ -// @baseUrl: / +// @baseUrl: / +// @ignoreDeprecations: 6.0 // @traceResolution: true // @target: esnext // @module: commonjs diff --git a/tests/cases/conformance/moduleResolution/typesVersions.justIndex.ts b/tests/cases/conformance/moduleResolution/typesVersions.justIndex.ts index 966a0a5415311..65837a77498f3 100644 --- a/tests/cases/conformance/moduleResolution/typesVersions.justIndex.ts +++ b/tests/cases/conformance/moduleResolution/typesVersions.justIndex.ts @@ -1,4 +1,5 @@ // @baseUrl: / +// @ignoreDeprecations: 6.0 // @traceResolution: true // @target: esnext // @module: commonjs