microsoft / microsoft/TypeScript
Paste with imports duplicates imports for namespace imports
Open
@navya9singh is already working on this.
Since Nov 12, 2024.
Needs Investigation
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 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);
- In
consts.ts, copyconsole.log(a); - 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.