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