fix: accept deprecated layout mix in ProSettings for tsc#9599
fix: accept deprecated layout mix in ProSettings for tsc#9599chenshuai2144 merged 1 commit intomasterfrom
Conversation
ProLayout maps mix to side at runtime; widening the type fixes tests and user configs that still pass layout="mix". Co-authored-by: 陈帅 <wasd2144@hotmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 Walkthrough概览此变更扩展了 变更
代码审查工作量估计🎯 1 (平凡) | ⏱️ ~3 分钟 诗
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the PureSettings type to include the 'mix' layout option and adds a deprecation notice for it. A review comment points out that using the @deprecated tag on the property itself causes IDEs to mark the entire property as deprecated, even for valid values like 'side' or 'top'. It is recommended to move the deprecation information into the description text instead.
| * @example 顶部菜单 layout="top" | ||
| * @example 侧边菜单 layout="side" | ||
| * @example 顶栏一级菜单 + 侧栏子菜单:layout="side" 且 `splitMenus`,或用 `headerMenuRender` 自定义顶栏菜单 | ||
| * @deprecated `layout="mix"` 仍会被接受,运行时按 `side` 处理,见 ProLayout 内注释 |
There was a problem hiding this comment.
Using the @deprecated tag on the layout property will cause IDEs to mark the entire property as deprecated (e.g., with a strikethrough), even when using valid values like 'side' or 'top'. Since only the 'mix' value is deprecated, it is better to include this information in the description text instead of using the @deprecated tag on the property itself.
| * @deprecated `layout="mix"` 仍会被接受,运行时按 `side` 处理,见 ProLayout 内注释 | |
| * `layout="mix"` 仍会被接受(已弃用),运行时按 `side` 处理,见 ProLayout 内注释 |
There was a problem hiding this comment.
Pull request overview
This PR aligns TypeScript typings with existing runtime behavior in ProLayout by allowing the legacy layout="mix" value (which is already normalized to 'side' at runtime), and documenting that legacy value as deprecated.
Changes:
- Widen
PureSettings['layout'](and thereforeProSettings['layout']) to include'mix'. - Add JSDoc documentation noting that
layout="mix"is deprecated and treated as'side'.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @example 顶部菜单 layout="top" | ||
| * @example 侧边菜单 layout="side" | ||
| * @example 顶栏一级菜单 + 侧栏子菜单:layout="side" 且 `splitMenus`,或用 `headerMenuRender` 自定义顶栏菜单 | ||
| * @deprecated `layout="mix"` 仍会被接受,运行时按 `side` 处理,见 ProLayout 内注释 |
There was a problem hiding this comment.
The @deprecated JSDoc here is attached to the layout property, so TypeScript will treat any use of layout as deprecated (including 'side'/'top'). If the intent is only to deprecate the 'mix' value, consider removing the @deprecated tag and describing the deprecation in plain text, or model 'mix' as a separately documented deprecated type member so only that value is flagged.
| * @deprecated `layout="mix"` 仍会被接受,运行时按 `side` 处理,见 ProLayout 内注释 | |
| * 注意:`layout="mix"` 已废弃,但仍会被接受,运行时按 `side` 处理,见 ProLayout 内注释 |
Summary
ProLayoutalready normalizeslayout="mix"tosideat runtime, butProSettings['layout']was typed as only'side' | 'top', which madetests/layout/index.test.tsxfailtsc.Widen the public type to include
'mix'and document it as deprecated so TypeScript matches runtime behavior.Verification
pnpm run tscSummary by CodeRabbit
新特性