MenuItemProps cannot extend HTMLAttributes under exactOptionalPropertyTypes
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript
- 领域
- frontend
调研方向
从 lib/interface.d.ts 中的 ItemSharedProps 和 lib/MenuItem.d.ts 中相互冲突的声明开始。使用 TypeScript 7.0.2 和列出的编译器选项(包括 exactOptionalPropertyTypes 和 skipLibCheck: false)复现错误。该 issue 描述的是仅涉及类型的更改;运行 tsc --noEmit,确认声明错误已消失。
由索引模型根据 Issue 内容生成。
描述
Summary
rc-menu 9.16.1, with TypeScript 7.0.2, "strict": true, "exactOptionalPropertyTypes": true, "skipLibCheck": false: its declarations report errors themselves (no error in user code is needed).
lib/MenuItem.d.ts TS2320 x2: Interface 'MenuItemProps' cannot simultaneously extend types 'Omit<MenuItemType, ...>' and 'Omit<HTMLAttributes, ...>'. Named properties className and style are not identical, because React declares them `?: T
Repro
{ "compilerOptions": { "strict": true, "exactOptionalPropertyTypes": true, "skipLibCheck": false,
"jsx": "react-jsx", "module": "esnext", "moduleResolution": "bundler", "noEmit": true } }
Import the package (or the antd 5 component that uses it) and run tsc --noEmit.
Fix (type-only; identical for consumers without the flag)
undefined.|In ItemSharedProps(lib/interface.d.ts):style?: React.CSSProperties | undefined; className?: string | undefined`
We run this as a local patch with no other changes. Happy to open a PR.
- 主要语言
- TypeScript
- 星标
- 700
- 派生
- 271
- 平均合并
- 1 小时 50 分钟
- 30 天内合并 PR
- 3
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react-component/menu 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 38/100
react-component/menu#833 · 1 条评论 ·
-
Ho未关闭
难度 5/5 一周以上 新手友好度 1/100
react-component/menu#790 ·
-
难度 3/5 1-2 天 新手友好度 35/100
react-component/menu#743 ·
-
难度 4/5 3-5 天 新手友好度 25/100
react-component/menu#742 ·
-
难度 2/5 1-3 小时 新手友好度 45/100
react-component/menu#732 · 1 个 reaction ·
查看 react-component/menu 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
Chocobozzz/PeerTube#7901 ·
维护者通常 3 天内回复
-
area:tools bug has repro
难度 2/5 1-3 小时 新手友好度 86/100
anthropics/claude-code#113984 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
ehmpathy/declapract-typescript-ehmpathy#960 ·
维护者通常 1 天内回复
-
area/web platform/windows type/bug version/v2
难度 2/5 1-3 小时 新手友好度 65/100
anomalyco/opencode#68237 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100