mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-11 16:38:46 -05:00
Change the module specifier search order
This commit is contained in:
@@ -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();`
|
||||
]);
|
||||
Reference in New Issue
Block a user