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 にある競合する宣言から始めます。exactOptionalPropertyTypes と skipLibCheck: false を含む、指定されたコンパイラーオプションで TypeScript 7.0.2 を使ってエラーを再現します。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分
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react-component/menu のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
react-component/menu#833 · コメント 1 件 ·
-
Hoオープン
難易度 5/5 1週間以上 初心者へのやさしさ 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 件 ·
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