Skip to content

Auto import generates wrong module specifier for a/index.ts when a.ts exists #36730

Open
@andrewbranch

Description

@andrewbranch

TypeScript Version: 3.8.1-rc

Search Terms: auto import index

Code

// tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs" // ensures `importModuleSpecifierEnding` defaults to `Ending.Minimal`
  }
}

// a/index.ts
export const aIndex = 0;

// a.ts
export {}

// index.ts
aIndex/* auto-import here */

Expected behavior:
Module specifier from auto-import is "./a/index"

Actual behavior:
Module specifier is "./a"

Related Issues: #36725 #24779

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Auto-importFix AvailableA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions