Skip to content

"importModuleSpecifierEnding" not added on "Move to new file" refactoringΒ #46290

Open
@jaens

Description

@jaens

Bug Report

πŸ”Ž Search Terms

.js extension missing; ECMAScript modules; ESNext

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Not possible, needs refactoring functionality.

πŸ’» Code

Open TypeScript project in VSCode with the following in settings.json:

{ "typescript.preferences.importModuleSpecifierEnding": "js" }

tsconfig.json:

{
    "compilerOptions": {
        "module": "ESNext"
    }
}

Create a file main.ts:

function foo() { }
function bar() { foo(); }

Execute "Move to new file" refactoring on the foo function.

πŸ™ Actual behavior

The following import is generated:

import { foo } from "./foo";

πŸ™‚ Expected behavior

import { foo } from "./foo.js";

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions