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

BUG: TS: Functionality Refactor: move to constant to existing file: if from that existing file already present import to current file, refactor will not reuse that import but instead adds new one #59027

Open
psnet opened this issue Jun 12, 2024 · 0 comments
Assignees
Labels
Bug A bug in TypeScript

Comments

@psnet
Copy link

psnet commented Jun 12, 2024

Does this issue occur when all extensions are disabled?: Yes

Version: 1.90.0 (user setup)
Commit: 89de5a8d4d6205e5b11647eb6a74844ca23d2573

Steps to Reproduce:

Functionality Refactor: move to constant to existing file: if from that existing file already present import to current file, refactor will not reuse that import but instead adds new one

  1. Two files:
// File `a.ts`
import {b} from b.ts;

const test = 2;
// File `b.ts`
export const b = 2;
  1. Now use Refactor constant test from file a.ts to existing file b.ts.

ER

file a.ts should be:

// File `a.ts`
import {b, test} from b.ts;

file b.ts should be:

// File `b.ts`
export const b = 2;
export const test = 2;

AR

file a.ts is:

// File `a.ts`
import {b} from b.ts;
import {test} from b.ts;        // problem here: 2 imports from same file

file b.ts is:

// File `b.ts`
export const b = 2;
export const test = 2;
@mjbvz mjbvz transferred this issue from microsoft/vscode Jun 25, 2024
@mjbvz mjbvz removed their assignment Jun 25, 2024
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jun 26, 2024
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 5.6.0 milestone Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants