Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts定义 requestSubscribeMessage.Option的entityIds请添加可选 #16130

Open
skyintree opened this issue Jul 19, 2024 · 0 comments · May be fixed by #16256
Open

ts定义 requestSubscribeMessage.Option的entityIds请添加可选 #16130

skyintree opened this issue Jul 19, 2024 · 0 comments · May be fixed by #16256
Assignees
Labels
A-typings Area - TypeScript Typings 相关 E-easy Helper Wanted - Easy F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@skyintree
Copy link

skyintree commented Jul 19, 2024

相关平台

微信小程序

小程序基础库: 3.4.6
使用框架: React

复现步骤

调用Taro.requestSubscribeMessage,非服务商不需要传入entityIds,导致下面这段ts定义报错,实际上非服务商并不需要传入entityIds。

namespace requestSubscribeMessage {
   interface Option {
     /**
      * 需要订阅的消息模板的id的集合(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置
      * @supported weapp, tt
      */
     tmplIds: string[]
     /** 需要订阅的消息模板 id 集合(注意:1、一次性模板 id 和长期性模板 id 不可同时使用,2、一次最多传入三个模板 id
      * @supported alipay
      */
     entityIds: string[]
     /** 模板小程序 appId,仅在服务商代调用场景下需要传入
      * @supported alipay
      */
     thirdTypeAppId?: string
     /** 接口调用结束的回调函数(调用成功、失败都会执行) */
     complete?: (res: TaroGeneral.CallbackResult) => void
     /** 接口调用失败的回调函数 */
     fail?: (result: FailCallbackResult) => void
     /** 接口调用成功的回调函数 */
     success?: (result: SuccessCallbackResult) => void
   }
}

期望结果

调用Taro.requestSubscribeMessage,非服务商不需要传入entityIds

实际结果

模板小程序 appId,仅在服务商代调用场景下需要传入 这个定义应该为可选,否则在代码中不传入entityIds会导致typescript报错

环境信息

👽 Taro v3.6.34


  Taro CLI 3.6.34 environment info:
    System:
      OS: Windows 11 10.0.22631
    Binaries:
      Node: 20.15.1 - D:\development.nodejs\node.EXE
      Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
      npm: 10.7.0 - D:\development.nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.34 => 3.6.34
      @tarojs/components: 3.6.34 => 3.6.34
      @tarojs/extend: 3.6.34 => 3.6.34
      @tarojs/helper: 3.6.34 => 3.6.34
      @tarojs/plugin-framework-react: 3.6.34 => 3.6.34
      @tarojs/plugin-html: 3.6.34 => 3.6.34
      @tarojs/plugin-platform-alipay: 3.6.34 => 3.6.34
      @tarojs/plugin-platform-h5: 3.6.34 => 3.6.34
      @tarojs/plugin-platform-jd: 3.6.34 => 3.6.34
      @tarojs/plugin-platform-qq: 3.6.34 => 3.6.34
      @tarojs/plugin-platform-swan: 3.6.34 => 3.6.34
      @tarojs/plugin-platform-tt: 3.6.34 => 3.6.34
      @tarojs/plugin-platform-weapp: 3.6.34 => 3.6.34
      @tarojs/react: 3.6.34 => 3.6.34
      @tarojs/runtime: 3.6.34 => 3.6.34
      @tarojs/shared: 3.6.34 => 3.6.34
      @tarojs/taro: 3.6.34 => 3.6.34
      @tarojs/taro-loader: 3.6.34 => 3.6.34
      @tarojs/webpack5-runner: 3.6.34 => 3.6.34
      babel-preset-taro: 3.6.34 => 3.6.34
      eslint-config-taro: 3.6.34 => 3.6.34
      react: ^18.0.0 => 18.0.0
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jul 19, 2024
@TheKonka TheKonka added A-typings Area - TypeScript Typings 相关 E-easy Helper Wanted - Easy labels Jul 20, 2024
TheKonka added a commit to TheKonka/taro that referenced this issue Aug 4, 2024
@TheKonka TheKonka linked a pull request Aug 4, 2024 that will close this issue
18 tasks
@TheKonka TheKonka linked a pull request Aug 4, 2024 that will close this issue
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typings Area - TypeScript Typings 相关 E-easy Helper Wanted - Easy F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

3 participants