Skip to content

Conversation

@lupingW
Copy link
Contributor

@lupingW lupingW commented Oct 11, 2025

这个 PR 做了什么? (简要描述所做更改)

这个 PR 是什么类型? (至少选择一个)

  • 错误修复 (Bugfix) issue: fix #
  • 新功能 (Feature)
  • 代码重构 (Refactor)
  • TypeScript 类型定义修改 (Types)
  • 文档修改 (Docs)
  • 代码风格更新 (Code style update)
  • 构建优化 (Chore)
  • 其他,请描述 (Other, please describe):

这个 PR 涉及以下平台:

  • 所有平台
  • Web 端(H5)
  • 移动端(React-Native)
  • 鸿蒙(Harmony)
  • 鸿蒙容器(Harmony Hybrid)
  • ASCF 元服务
  • 快应用(QuickApp)
  • 所有小程序
  • 微信小程序
  • 企业微信小程序
  • 京东小程序
  • 百度小程序
  • 支付宝小程序
  • 支付宝 IOT 小程序
  • 钉钉小程序
  • QQ 小程序
  • 飞书小程序
  • 快手小程序
  • 头条小程序

Summary by CodeRabbit

  • Refactor
    • 重构订阅消息 API 的参数类型,抽离 BaseOption,并以类型工具强制 tmplIds 与 entityIds 成对提供;保持原有使用体验,提升类型一致性与可读性。
  • Bug Fixes
    • 加强类型校验,在编译期提示缺失必要字段,减少因参数不完整导致的调用错误,提升开发体验与稳定性。

@coderabbitai
Copy link

coderabbitai bot commented Oct 11, 2025

Walkthrough

packages/taro/types/api/open-api/subscribe-message.d.ts 中重构了类型定义:将 requestSubscribeMessage 的内部 Option 拆分为 BaseOption,新增泛型工具类型 AtLeastOne,并以该工具类型生成新的 Option 类型别名,要求 tmplIdsentityIds 成组必填。

Changes

Cohort / File(s) Change Summary
订阅消息类型重构
packages/taro/types/api/open-api/subscribe-message.d.ts
- 原 interface Option 重命名为 interface BaseOption
- 新增泛型 AtLeastOne<T, Keys> 用于将指定键设为必填。
- 新增类型别名 Option = AtLeastOne<BaseOption, 'tmplIds' | 'entityIds'>,强制 tmplIdsentityIds 同时提供。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Single-Dancer

Poem

小兔敲键把耳竖,
类型重排不含糊。
tmplIds 携手 entityIds,
缺一不可成双入。
字里行间风不驻,
规范严谨跳一步。 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed 这个标题简洁明确地指出了修复 requestSubscribeMessage 的 TypeScript 类型错误,与 PR 的主要改动完全匹配。
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ff04a2 and e9e84f1.

📒 Files selected for processing (1)
  • packages/taro/types/api/open-api/subscribe-message.d.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/taro/types/api/open-api/subscribe-message.d.ts (1)
packages/taro-runtime-rn/src/types/index.d.ts (1)
  • BaseOption (180-184)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
🔇 Additional comments (2)
packages/taro/types/api/open-api/subscribe-message.d.ts (2)

27-28: 工具类型实现正确

AtLeastOne 工具类型的实现通过分布式条件类型正确创建了联合类型,可以用于要求至少提供指定键中的一个。当 BaseOption 中的相关字段被标记为可选后,此工具类型将按预期工作。


30-30: 类型别名定义合理

使用 AtLeastOne 创建 Option 类型别名的方式是正确的。当 BaseOption 中的字段被修复为可选后,此定义将确保调用者必须提供 tmplIdsentityIds 中的至少一个字段,符合不同平台的使用要求。


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.

@coderabbitai coderabbitai bot requested a review from Single-Dancer October 11, 2025 11:05
@codecov
Copy link

codecov bot commented Oct 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.97%. Comparing base (8ff04a2) to head (e9e84f1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main   #18460    +/-   ##
========================================
  Coverage   55.97%   55.97%            
========================================
  Files         416      416            
  Lines       21560    21560            
  Branches     5264     5307    +43     
========================================
  Hits        12069    12069            
- Misses       7907     8014   +107     
+ Partials     1584     1477   -107     
Flag Coverage Δ
taro-cli 72.85% <ø> (ø)
taro-runtime 59.87% <ø> (ø)
taro-web 53.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 54 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Single-Dancer Single-Dancer added this to the 4.1.8 milestone Oct 13, 2025
@Single-Dancer Single-Dancer merged commit 1414e3d into NervJS:main Oct 14, 2025
34 of 35 checks passed
This was referenced Oct 18, 2025
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.

2 participants