microsoft / microsoft/TypeScript

Rename symbol renamed element declaration in node_modules

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

还没有人认领这个 Issue。

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

描述

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: Insider (don't remember the precise version, explained below)
  • OS Version: 10.0.19044 Build 19044 (Microsoft Windows 10 IoT Enterprise LTSC)
Steps to Reproduce:
  1. use "Rename Symbol" [F2 default keybind] to rename a jsx/tsx element in a .tsx file (in my case it was p -> span)
Expected outcome:

element to be renamed to the entered one (span)

Actual outcome:
  1. Renamed the element's declaration in node_modules/@types/react/index.d.ts for the entire project.
  2. renamed the element in the file i was working in to span (effectively still remaining a paragraph element)
  3. code editor throwing error Property 'p' does not exist on type 'JSX.IntrinsicElements'. anywhere where element p is used
// code snippet from node_modules/@types/react/index.d.ts
span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
Additional information:

This happened around a month ago, therefore I cannot recall the version I was on.
I had attempted reinstalling packages, code editors (both insider and default one), package managers (npm, bun, yarn, pnpm), with and without tsgo.
Could not fix the error during this whole time, so I worked on the project on a different machine which didn't have the issue.

Let me know if there if you need any additional information

贡献指南

打开贡献指南

从这里开始

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

调研方向

在 .tsx 文件中使用报告的 JSX 元素情形重现 Rename Symbol/F2 操作,然后检查 node_modules/@types/react/index.d.ts 中受影响的声明。验证重命名是否会更改该声明并导致报告的 JSX.IntrinsicElements 错误;当本地元素在不修改该声明的情况下完成重命名时,即表示完成。

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

评估

技术栈
react, typescript
领域
developer-experience, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

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