Skip to content

fix: accept deprecated layout mix in ProSettings for tsc#9599

Merged
chenshuai2144 merged 1 commit intomasterfrom
cursor/fix-layout-mix-tsc-63cf
May 2, 2026
Merged

fix: accept deprecated layout mix in ProSettings for tsc#9599
chenshuai2144 merged 1 commit intomasterfrom
cursor/fix-layout-mix-tsc-63cf

Conversation

@chenshuai2144
Copy link
Copy Markdown
Contributor

@chenshuai2144 chenshuai2144 commented Apr 22, 2026

Summary

ProLayout already normalizes layout="mix" to side at runtime, but ProSettings['layout'] was typed as only 'side' | 'top', which made tests/layout/index.test.tsx fail tsc.

Widen the public type to include 'mix' and document it as deprecated so TypeScript matches runtime behavior.

Verification

  • pnpm run tsc

Submitted by Cursor

Open in Web Open in Cursor 

Summary by CodeRabbit

新特性

  • 新增混合布局模式。应用现在支持侧边栏、顶部和混合三种布局选项,为用户提供更加灵活的界面配置选择。

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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0e5f5b0c-c8f7-4936-abbe-f276ef4af90c

📥 Commits

Reviewing files that changed from the base of the PR and between 83c5b22 and 78385bf.

📒 Files selected for processing (1)
  • src/layout/defaultSettings.ts

📝 Walkthrough

概览

此变更扩展了 src/layout/defaultSettings.tsPureSettings.layout 的类型定义,添加了 'mix' 选项,并注明该选项在运行时被处理为 'side'

变更

变更组 / 文件 摘要
布局配置类型扩展
src/layout/defaultSettings.ts
将布局类型从 'side' | 'top' 扩展至 'side' | 'top' | 'mix',并添加内联文档说明 layout="mix" 在运行时被当作 side 处理。

代码审查工作量估计

🎯 1 (平凡) | ⏱️ ~3 分钟

🐰 轻轻一跳,混合布局现身,
三种配置齐声欢呼,
侧边与顶部共舞,
混合选项悄然融入,
类型系统更加完美!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题准确总结了主要变更:在ProSettings中接受已弃用的'mix'布局值以解决tsc类型检查问题。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/fix-layout-mix-tsc-63cf
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch cursor/fix-layout-mix-tsc-63cf

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 内注释
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
* @deprecated `layout="mix"` 仍会被接受,运行时按 `side` 处理,见 ProLayout 内注释
* `layout="mix"` 仍会被接受(已弃用),运行时按 `side` 处理,见 ProLayout 内注释

@chenshuai2144 chenshuai2144 marked this pull request as ready for review April 22, 2026 07:55
Copilot AI review requested due to automatic review settings April 22, 2026 07:55
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 22, 2026
@dosubot dosubot Bot added the layout label Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 therefore ProSettings['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 内注释
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
* @deprecated `layout="mix"` 仍会被接受,运行时按 `side` 处理,见 ProLayout 内注释
* 注意:`layout="mix"` 已废弃,但仍会被接受,运行时按 `side` 处理,见 ProLayout 内注释

Copilot uses AI. Check for mistakes.
@chenshuai2144 chenshuai2144 merged commit 847468b into master May 2, 2026
10 of 15 checks passed
@chenshuai2144 chenshuai2144 deleted the cursor/fix-layout-mix-tsc-63cf branch May 2, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

layout size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants