microsoft / microsoft/TypeScript

Typescript gets confused when renaming by only changing filename case of imported file on Windows

Open
#60,756 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: Module Resolution Needs Human Review Needs More Info
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

🔎 Search Terms

windows rename already included

🕗 Version & Regression Information
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______
⏯ Playground Link

No response

💻 Code

file src/vector.js

export default class Vector {}

file test/vector.test.js

import Vector from '../src/vector.js'
new Vector();

now rename the file

mv src/vector.js src/Vector.js

and update the file test/vector.test.js

import Vector from '../src/Vector.js'
new Vector();
🙁 Actual behavior

There is an error message:
Image

🙂 Expected behavior

No error message, as the imported file name matches the actual file name.

Additional information about the issue

tsconfig.json

{
    "compilerOptions": {
      "target": "ES2017",
      "module": "commonjs",
      "lib": ["es2017", "dom", "DOM.Iterable"],
      "allowJs": true,
      "checkJs": true,
      "skipLibCheck": true,
      "declaration": true,
      "noEmit": true,
      "strict": true,
      "baseUrl": ".",
      "typeRoots": [
        "./node_modules/@types",
      ],
      "esModuleInterop": true
    },
    "include": [
      "src/**/*.js",
      "test/**/*.js",
    ]
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction using src/vector.js, test/vector.test.js, the case-only rename to src/Vector.js, and the supplied tsconfig.json on Windows. Trace the compiler's handling of the updated import and verify that the case-matched import produces no error after the rename.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.