Skip to content

chore(types): 删除手写 react-syntax-highlighter/@lobehub/icons ambient 重复声明,收敛至官方 @types - #2184

Merged
DeliciousBuding merged 1 commit into
masterfrom
chore/cleanup-round-39
Sep 1, 2026
Merged

chore(types): 删除手写 react-syntax-highlighter/@lobehub/icons ambient 重复声明,收敛至官方 @types#2184
DeliciousBuding merged 1 commit into
masterfrom
chore/cleanup-round-39

Conversation

@DeliciousBuding

Copy link
Copy Markdown
Collaborator

Summary

删除 web vendor-types.d.ts 与 desktop vite-env.d.ts 中手写的 react-syntax-highlighter / @lobehub/icons ambient 声明(-122 行),类型全部收敛至已安装的官方 @types/react-syntax-highlighter@^15.5.13#2154 前端遗留候选 C(round-38 探索取证,推荐项)。

动机(取证)

  1. 纯重复app/package.json:45 已装 @types/react-syntax-highlighter(1133 个 declare module),web tsconfig 无 types 限制自动纳入;手写块的每一行都是重复。
  2. 内容已漂移:真实在用的 jsxshared/src/ui/prismRegistry.ts:20)两份手写声明都缺;从未被导入的 java/kotlin/swift 却在 web 版声明(死声明);两份拷贝彼此失同步(17 vs 16 子模块)。
  3. @lobehub/icons 根模块声明是死的:全仓无根导入(生产全走深路径 @lobehub/icons/es/*shared/src/ui/RuntimeIcon.tsx),仅测试 vi.mock 不需要类型。

Scope

  • app/web/src/vendor-types.d.ts(整文件 104 行)
  • app/desktop/src/vite-env.d.ts 手写 RSH 块(保留 /// <reference types=\"vite/client\" />
  • 零运行时代码变更(纯类型层);回退成本 = 恢复两文件

验证证据(本地)

  • pnpm --filter agenthub-web typecheck(tsc -p tsconfig.json)✅
  • pnpm --filter agenthub-desktop typecheck(tsconfig.app.json,含 types: [] 限制)✅
  • desktop 根 tsconfig(含测试)tsc -p tsconfig.json
  • shared/workbench typecheck ✅
  • shared vitest:CodeBlock/prismRegistry 24/24、Markdown 38/38 ✅
  • 6 项 verifier(doc-ssot/ci-gates/i18n-deadkeys/openapi-contract/migration-idempotency/i18n-terminology)+ git diff --check

风险

  • desktop tsconfig.app.jsontypes: [],但实测删除后 tsc 全绿(RSH 导入经模块解析仍命中 @types,且 desktop app 面未直接引入 prismRegistry 链)。若 CI 出现 TS2307,回退或补 /// <reference types="react-syntax-highlighter" /> 一行即可。

- 删 app/web/src/vendor-types.d.ts 整文件(RSH 17 子模块块 + @lobehub/icons 根模块块,均零消费或已被官方类型覆盖)
- 删 app/desktop/src/vite-env.d.ts 中 RSH 16 子模块手写块,保留 vite/client 引用
- 官方 @types/react-syntax-highlighter@^15.5.13 已装(1133 declare module),覆盖全部实际导入路径
- 手写块已漂移:真实在用 jsx 两份都缺、从未导入的 java/kotlin/swift 声明两份
- #2154 前端遗留候选 C(round-38 探索取证)

Co-authored-by: Cursor <cursor@vectorcontrol.tech>
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 60da9ca8-9603-465b-8ac3-f3295edaeec4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@DeliciousBuding
DeliciousBuding merged commit 4c074a0 into master Sep 1, 2026
41 checks passed
@DeliciousBuding
DeliciousBuding deleted the chore/cleanup-round-39 branch September 1, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant