mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Don’t offer non-relative non-paths path when baseUrl is undefined (#40813)
This commit is contained in:
parent
343a0a04d7
commit
3e824f18a8
@ -174,7 +174,10 @@ namespace ts.moduleSpecifiers {
|
||||
const bundledPkgReference = bundledPackageName ? combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
|
||||
const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
|
||||
const fromPaths = paths && tryGetModuleNameFromPaths(removeFileExtension(bundledPkgReference), importRelativeToBaseUrl, paths);
|
||||
const nonRelative = fromPaths === undefined ? importRelativeToBaseUrl : fromPaths;
|
||||
const nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
|
||||
if (!nonRelative) {
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
if (relativePreference === RelativePreference.NonRelative) {
|
||||
return nonRelative;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
//// "compilerOptions": {
|
||||
//// "module": "commonjs",
|
||||
//// "paths": {
|
||||
//// "@app/*": ["lib/*"]
|
||||
//// "@app/*": ["./lib/*"]
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
@ -0,0 +1,21 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: /packages/test-package-1/tsconfig.json
|
||||
//// {
|
||||
//// "compilerOptions": {
|
||||
//// "module": "commonjs",
|
||||
//// "paths": {
|
||||
//// "test-package-2/*": ["../test-package-2/src/*"]
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
|
||||
// @Filename: /packages/test-package-1/src/common/logging.ts
|
||||
//// export class Logger {};
|
||||
|
||||
// @Filename: /packages/test-package-1/src/something/index.ts
|
||||
//// Logger/**/
|
||||
|
||||
|
||||
goTo.marker("");
|
||||
verify.importFixAtPosition([`import { Logger } from "../common/logging";\n\nLogger`]);
|
||||
Loading…
x
Reference in New Issue
Block a user