
Description
Bug Report
π Search Terms
import folder file refactor
π Version & Regression Information
4.4.0-insiders.20210805, next, and the 4.3.x branch
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about ...?
β― Playground Link
Can't reproduce in playground as it has to do with multiple files and imports
π» Code
This has to do with file imports, so I made a minimal repro:
https://github.com/MarkKahn/ts-import-refactor-bug.git
π Actual behavior
I was refactoring a file, module.ts
into a directory, module
. I created module/index.ts
, and in module/submodule.ts
I had written: import { otherSubModule } from '.'
TS threw an error saying Module '"."' has no exported member 'otherSubModule'.ts(2305)
After some banging my head on the wall I figured out that from '.'
wasn't referencing ./index.ts
, but instead was referencing ../module.ts
π Expected behavior
import from '.'
should reference the current folder, always. This is likely only a bug that would be triggered when refactoring code as I can't think of a use case for a file and folder to have the same name and be a valid structure.