wechat-miniprogram / wechat-miniprogram/api-typings

SubscriptionsSetting的itemSettings类型希望是Record<string, 'accept | 'reject' | 'ban'>

Open
#186 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
803
Forks
117
Avg merge
24m
Merged PRs (30d)
1

Description

    /** 订阅消息设置 */
    interface SubscriptionsSetting {
        /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html) */
        itemSettings: IAnyObject
        /** 订阅消息总开关,true为开启,false为关闭 */
        mainSwitch: boolean
    }

现在是IAnyObject,不过既然已经知道是有哪些会返回哪些,所以希望是

    interface SubscriptionsSetting {
        itemSettings: Record<string, 'accept | 'reject' | 'ban'>
        mainSwitch: boolean
    }

这样在相关判断的时候,避免输错文本

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the TypeScript declarations for the SubscriptionsSetting interface and inspect its itemSettings property and nearby API types. Update the property to represent the documented subscription statuses, then run the repository's available type-check or test command and confirm existing consumers still type-check.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.