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

Alias import is moved incorrectly when moving code to another file #59798

Closed
alexdima opened this issue Aug 29, 2024 · 2 comments · Fixed by #59885
Closed

Alias import is moved incorrectly when moving code to another file #59798

alexdima opened this issue Aug 29, 2024 · 2 comments · Fixed by #59885
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@alexdima
Copy link
Member

alexdima commented Aug 29, 2024

// @filename: src/_producer.ts
export function doit() {}
// @filename: src/_consumer.ts
import { doit as doit2 } from "./_producer";

class Another {}

class Consumer {
    constructor() {
        doit2();
    }
}

Doing move to a new file on Consumer generates the following 🐛 (note how doit2 does not exist in _producer.ts):

// @filename: src/Consumer.ts
import { doit2 } from "./_producer";

class Consumer {
    constructor() {
        doit2();
    }
}
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Aug 30, 2024
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 5.7.0 milestone Aug 30, 2024
@hasanalkaf3
Copy link

It works with me
image

@alexdima
Copy link
Member Author

alexdima commented Sep 5, 2024

I can reproduce in vscode 1.93.0-insider / 4849ca9bdf9666755eb463db297b69e5385090e3 and TS version 5.5.4

Kapture.2024-09-05.at.17.42.59.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants