microsoft / microsoft/TypeScript

ts1484 Quick fix will dupe comments

Open
#64,272 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
111k
Forks
14.3k
PR merge metrics
PR metrics pending

Description

### 🔎 Search Terms

"quickfix comment" "dupe comment"

### 🕗 Version & Regression Information

- This changed between versions 6.0.0-dev.20260416 and 6.0.3 of vscode extensions.

### ⏯ Playground Link

_No response_

### 💻 Code

index.ts:
```ts
// upper comment
/*left comment*/ import { foo } from "./foo"; // right comment
// lower comment
```
foo.ts:
```ts
export type foo = "foo":
```
and enable verbatimModuleSyntax.
then run quick fix `use 'import type'`.

### 🙁 Actual behavior
index.ts:
```ts
// upper comment
/*left comment*/ // upper comment
/*left comment*/ import type { foo } from "./foo"; // right comment
// right comment
// lower comment
```
upper, left and right comment is duped.

### 🙂 Expected behavior
```ts
// upper comment
/*left comment*/ import type { foo } from "./foo"; // right comment
// lower comment
```
### Additional information about the issue

ts1484 error: 'foo' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the index.ts and foo.ts snippets, enable verbatimModuleSyntax, and invoke the ts1484 quick fix to use an import type. Start by tracing the quick-fix behavior for that diagnostic; done means the import changes without duplicating the upper, left, or right comments.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.