Merge pull request #13424 from zhengbli/13129
Change the module specifier search order
This commit is contained in:
commit
a36db0ea10
2 changed files with 25 additions and 2 deletions
|
@ -420,10 +420,10 @@ namespace ts.codefix {
|
|||
const options = context.program.getCompilerOptions();
|
||||
|
||||
return tryGetModuleNameFromAmbientModule() ||
|
||||
tryGetModuleNameFromBaseUrl() ||
|
||||
tryGetModuleNameFromRootDirs() ||
|
||||
tryGetModuleNameFromTypeRoots() ||
|
||||
tryGetModuleNameAsNodeModule() ||
|
||||
tryGetModuleNameFromBaseUrl() ||
|
||||
tryGetModuleNameFromRootDirs() ||
|
||||
removeFileExtension(getRelativePath(moduleFileName, sourceDirectory));
|
||||
|
||||
function tryGetModuleNameFromAmbientModule(): string {
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: a/f1.ts
|
||||
//// [|foo/*0*/();|]
|
||||
|
||||
// @Filename: types/random/index.ts
|
||||
//// export function foo() {};
|
||||
|
||||
// @Filename: tsconfig.json
|
||||
//// {
|
||||
//// "compilerOptions": {
|
||||
//// "baseUrl": ".",
|
||||
//// "typeRoots": [
|
||||
//// "./types"
|
||||
//// ]
|
||||
//// }
|
||||
//// }
|
||||
|
||||
verify.importFixAtPosition([
|
||||
`import { foo } from "random";
|
||||
|
||||
foo();`
|
||||
]);
|
Loading…
Reference in a new issue