microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.26k stars 12.52k forks source link

`Convert to namespace import` refactoring should drop file extensions on namespace name #60505

Closed mjbvz closed 1 week ago

mjbvz commented 1 week ago

🔎 Search Terms

🕗 Version & Regression Information

5.8.0-dev.20241114

not a regression

⏯ Playground Link

No response

💻 Code

For code such as:

import { abc } from "./a.js";

console.log(abc);
  1. Run convert to namespace import

🙁 Actual behavior

The new namespace name is aJs:

import * as aJs from "./a.js";

console.log(aJs.abc);

🙂 Expected behavior

It would be better to drop the file extension as part of the name:

import * as a from "./a.js";

console.log(a.abc);

Additional information about the issue

No response