Skip to content

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

@skyintree

Description

@skyintree

相关平台

微信小程序

小程序基础库: 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

Metadata

Metadata

Assignees

Labels

A-typingsArea - TypeScript Typings 相关E-easyHelper Wanted - EasyF-reactFramework - ReactT-weappTarget - 编译到微信小程序V-3Version - 3.x

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions