Repository navigation
fix(type): align ItemSharedProps with HTMLAttributes under exactOptionalPropertyTypes - #905
young-tree wants to merge 1 commit into
Conversation
…nalPropertyTypes MenuItemProps extends both Omit<MenuItemType, ...> and Omit<HTMLAttributes<HTMLLIElement>, ...>. ItemSharedProps.style/className were declared without undefined while HTMLAttributes carries it, so projects compiling with exactOptionalPropertyTypes and skipLibCheck: false got TS2320 x2 inside the published declarations (react-component#904). Widening the two members is additive for everyone else. Verified with tsc 7.0.2 and 6.0.3 (strict + exactOptionalPropertyTypes + skipLibCheck: false): the TS2320s disappear. Full suite: 14 suites, 153 tests pass.
|
@young-tree is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. Walkthrough
ChangesItemSharedProps 类型调整
Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk:
|
Summary
MenuItemPropsextends bothOmit<MenuItemType, ...>andOmit<React.HTMLAttributes<HTMLLIElement>, ...>.ItemSharedPropsdeclaredstyle/classNamewithoutundefined, whileHTMLAttributescarries it — so withexactOptionalPropertyTypes: true+skipLibCheck: falsethe published declarations fail their own check with TS2320 ×2 (className,style), as reported in #904.Widen the two members with
| undefined(additive; no change for projects without the flag).Verification
strict+exactOptionalPropertyTypes+skipLibCheck: false, consumer importingMenu: the TS2320s disappear.Fixes #904
Summary by CodeRabbit
style和className属性现在可显式设置为undefined,提升了启用严格可选属性类型检查的项目中的兼容性。