microsoft / microsoft/TypeScript

Paste with imports duplicates imports for namespace imports

Offen
#60,419 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@navya9singh arbeitet bereits daran.

Seit 12.11.2024.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

🔎 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.