Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Move to file" generates self-import when target file already imports declaration #54309

Open
DanielRosenwasser opened this issue May 18, 2023 · 0 comments
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol
Milestone

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented May 18, 2023

Possibly the same as #54307.

basics.ts

export function getHello() {
    return "hello";
}

export function getWorld() {
    return "world";
}

greeting.ts

import { getHello, getWorld } from "./basics";

export function getGreeting() {
    return getHello() + getWorld();
}

Extract getWorld into greeting.ts and this is what it looks like:

import { getHello } from "./basics";
import { getWorld } from "./greeting";

export function getGreeting() {
    return getHello() + getWorld();
}
export function getWorld() {
    return "world";
}

The line import { getWorld } from "./greeting"; should not be present at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol
Projects
None yet
Development

No branches or pull requests

2 participants