Skip to content

"typescript.preferences.importModuleSpecifierEnding": "js" causes duplicate extensions when refactoring Β #45678

@realh

Description

@realh

Bug Report

πŸ”Ž Search Terms

importModuleSpecifierEnding
Import Module Specifier Ending

πŸ•— Version & Regression Information

I've confirmed this in TS 3.9.7 (installed by npm) and 4.4.2 (Arch Linux package).

⏯ Playground Link

Sorry, I don't know how I could reproduce this outside of VS Code.

πŸ’» Code

// We can quickly address your report if:
//  - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
//  - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.
//  - The incorrectness of the behavior is readily apparent from reading the sample.
// Reports are slower to investigate if:
//  - We have to pare too much extraneous code.
//  - We have to clone a large repo and validate that the problem isn't elsewhere.
//  - The sample is confusing or doesn't clearly demonstrate what's wrong.

πŸ™ Actual behavior

I have "typescript.preferences.importModuleSpecifierEnding": "js" in my settings. I renamed a project folder in VS Code (using F2 in the Linux version), then clicked Yes to refactor all the other TS code that imported from that folder, using ".js" extensions. The folder was renamed successfully for each import, but they were all given a second ".js" extension, ie they were renamed to "*.js.js".

πŸ™‚ Expected behavior

The additional ".js" shouldn't have been added where one was already present.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbolRescheduledThis 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