You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BaseOptionType fails Required<OptionType> constraint under exactOptionalPropertyTypes #670
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: import type { CascaderProps } from "@rc-component/cascader";
@rc-component/cascader/es/Cascader.d.ts(70,229): error TS2344: Type 'Required<OptionType>' does not satisfy the constraint 'DefaultOptionType'.
Type 'Required<OptionType>' is not assignable to type 'BaseOptionType'.
Types of property 'disabled' are incompatible.
Type 'OptionType["disabled"]' is not assignable to type 'boolean'.
Type 'boolean | undefined' is not assignable to type 'boolean'.
Type 'undefined' is not assignable to type 'boolean'.
The identical error is also reported at (70,277). With exactOptionalPropertyTypes: false the file compiles with 0 errors. The same declaration file also fails TS2430 on placement, filed separately as #671.
Opened #672 with the suggested member widening (disabled/disableCheckbox/value/children gain | undefined), plus the placement TS2430 from #671 (NonNullable). Verified with tsc 7.0.2 and 6.0.3 under strict + exactOptionalPropertyTypes + skipLibCheck: false — all three declaration errors disappear; suite 128 tests pass.
Activity
VishnuPatel9009 commentedon Nov 17, 2026
Confirming the same TS2344 on the current
@rc-component/cascaderline, not only rc-cascader 3.x:@rc-component/cascader1.26.0 (resolved by antd 6.7.0), TypeScript 6.0.3, @types/react 19.3.0,strict,exactOptionalPropertyTypes: true,skipLibCheck: false,moduleResolution: "Bundler".import type { CascaderProps } from "@rc-component/cascader";The identical error is also reported at (70,277). With
exactOptionalPropertyTypes: falsethe file compiles with 0 errors. The same declaration file also fails TS2430 onplacement, filed separately as #671.young-tree commentedon Nov 19, 2026
Opened #672 with the suggested member widening (
disabled/disableCheckbox/value/childrengain| undefined), plus theplacementTS2430 from #671 (NonNullable). Verified with tsc 7.0.2 and 6.0.3 under strict + exactOptionalPropertyTypes + skipLibCheck: false — all three declaration errors disappear; suite 128 tests pass.fix(type): keep explicit undefined for placement and exclude it from …