microsoft / microsoft/TypeScript

Paste with imports duplicates imports for namespace imports

Đang mở
#60,419 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@navya9singh đang làm issue này rồi.

Từ ngày 12/11/2024.

Needs Investigation
Ngôn ngữ chính
Go
Star
111k
Fork
14.4k
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
117

Mô tả

🔎 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.