-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: 修复文档站点 React 依赖类型错误 #4983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 修复文档站点 React 依赖类型错误 #4983
Conversation
Summary of ChangesHello @louhaojie99, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在解决文档站点项目中存在的 React 类型依赖缺失问题。通过引入必要的类型定义包,确保了开发环境的类型检查正确性,从而提升了开发体验并避免了潜在的类型相关错误。 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次 PR 旨在修复文档站点的 React 类型问题,通过添加 @types/react 和 @types/react-dom 依赖。然而,对于 React 19,这种做法是不正确的,因为 React 19 已经内置了其 TypeScript 类型。添加这些独立的 @types 包可能会与内置类型产生冲突,导致更难以排查的问题。因此,我建议移除这些新增的依赖,并从其他方面(例如 tsconfig.json 配置或检查其他依赖项与 React 19 的兼容性)来解决根本的类型错误问题。
| "@types/react": "^19.2.7", | ||
| "@types/react-dom": "^19.2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你好,此更改添加了 @types/react 和 @types/react-dom,但对于 React 19 来说这是不必要的,甚至可能是有害的。
React 19 已将 TypeScript 类型定义内置于包中。因此,单独安装 @types 包会导致类型定义重复,并可能引发难以诊断的冲突错误。
建议移除这两个依赖项,并调查原始类型错误的根本原因。这可能与 tsconfig.json 中的配置或项目中其他尚未完全兼容 React 19 的依赖项(例如 dumi)有关。
更多信息请参阅 React 19 Beta 公告。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看下 @louhaojie99
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实是,react v19 新版本不依赖了 @types/react 和 @types/react-dom。
📝 Description
site 文档站点项目缺失 react 相关 types 包。
🖼️ Screenshot
💡 Motivation and Context
🧩 Types of changes
🔍 Self Check before Merge