microsoft / microsoft/TypeScript

ts1484 Quick fix will dupe comments

未关闭
#64,272 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

🔎 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:

// upper comment
/*left comment*/ import { foo } from "./foo"; // right comment
// lower comment

foo.ts:

export type foo = "foo":

and enable verbatimModuleSyntax.
then run quick fix use 'import type'.

🙁 Actual behavior

index.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
// 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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 index.ts 和 foo.ts 代码片段重现该问题,启用 verbatimModuleSyntax,并调用 ts1484 快速修复以使用 import type。首先跟踪该诊断的快速修复行为;完成的标准是 import 发生更改,同时不重复上方、左侧或右侧的注释。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。