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

Paste with imports duplicates imports for namespace imports #60419

Open
mjbvz opened this issue Nov 5, 2024 · 1 comment
Open

Paste with imports duplicates imports for namespace imports #60419

mjbvz opened this issue Nov 5, 2024 · 1 comment
Assignees

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Nov 5, 2024

πŸ”Ž Search Terms

  • paste with imports
  • paste update imports

πŸ•— Version & Regression Information

5.7.0-dev.20241030

⏯ Playground Link

No response

πŸ’» Code

consts.ts

export const a = 123;

console.log(a);

index.ts

import * as consts from "./consts";

console.log(consts.a);
  1. In consts.ts, copy console.log(a);
  2. Paste into index.ts

πŸ™ Actual behavior

Imports get duplicated:

import * as consts from "./consts";
import { a } from "./consts";

console.log(consts.a);
console.log(a);

πŸ™‚ Expected behavior

It should rewrite the code to use the existing import:

import * as consts from "./consts";

console.log(consts.a);
console.log(consts.a);

Additional information about the issue

No response

@Andarist
Copy link
Contributor

Andarist commented Nov 5, 2024

Similar things happen with "move to a file" refactoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants