BaseOptionType fails Required<OptionType> constraint under exactOptionalPropertyTypes
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- react, typescript
- 領域
- frontend
調査の方向性
Start with BaseOptionType in the package declarations and inspect how its optional properties interact with Required<OptionType> in GetValueType. Reproduce the declaration errors using TypeScript 7.0.2 with exactOptionalPropertyTypes enabled and skipLibCheck disabled. Update the affected optional property types as described, then confirm tsc --noEmit passes with the repro configuration.
索引モデルが issue の本文から書いたものです。
説明
Summary
rc-cascader 3.33.1–3.34.0, with TypeScript 7.0.2, "strict": true, "exactOptionalPropertyTypes": true, "skipLibCheck": false: its declarations report errors themselves (no error in user code is needed).
lib/Cascader.d.ts TS2344 x2 in GetValueType: Required<OptionType> does not satisfy the constraint 'DefaultOptionType'. Required<> strips undefined from disabled?: boolean (and disableCheckbox), and under the flag OptionType['disabled'] (which still includes undefined via the generic) is then not assignable to boolean.
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)
In BaseOptionType: disabled?: boolean | undefined; disableCheckbox?: boolean | undefined; value?: string | number | null | undefined; children?: DefaultOptionType[] | undefined
We run this as a local patch with no other changes. Happy to open a PR.
- 主要言語
- TypeScript
- スター
- 235
- フォーク
- 153
- 平均マージ
- 8分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react-component/cascader のほかの issue
-
BaseCascaderProps fails TS2430 (placement) under exactOptionalPropertyTypes対応中かも @young-tree が 15 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
react-component/cascader#671 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
react-component/cascader#594 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
react-component/cascader#540 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
react-component/cascader#539 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
react-component/cascader#468 ·
react-component/cascader の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
Techiebutler/freeframe#687 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 2 日以内に返信
-
enhancement from-app needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
nightly-labs/openbot#23050 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
vercel-labs/skills#2967 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OHDSI/Data2Evidence#3846 ·
メンテナーはふだん 3 日以内に返信