Skip to content

Commit

Permalink
fix: typing of referrerInfo in App#onShow and query in LaunchOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
SgLy committed Aug 24, 2023
1 parent 7c22bf6 commit 7da83ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2023-08-24 v3.12.0
- `App` 生命周期 `onLaunch`, `onShow` 参数中的 `referrerInfo` 字段类型对齐 API 定义中的 `ReferrerInfo`。这是一个 **破坏性改动**,其中 `extraData` 的类型从 `any` 收窄到了 `Record<string, any>`
- 根据实际实现,修改了 `LaunchOptions``query` 字段的类型。这是一个 **破坏性改动**,该类型从 `Record<string, any>` 收窄到了 `Record<string, string>`

## 2023-08-24 v3.11.1
- 更新 API 定义到 3.0.1

Expand Down
4 changes: 2 additions & 2 deletions types/wx/lib.wx.api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6924,7 +6924,7 @@ InnerAudioContext.offWaiting(listener) // 需传入与监听时同一个的函
/** 启动小程序的路径 (代码包路径) */
path: string
/** 启动小程序的 query 参数 */
query: IAnyObject
query: Record<string, string>
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
referrerInfo: ReferrerInfo
/** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
Expand Down Expand Up @@ -7938,7 +7938,7 @@ NFCAdapter.offDiscovered(listener) // 需传入与监听时同一个的函数对
/** 不存在页面的路径 (代码包路径) */
path: string
/** 打开不存在页面的 query 参数 */
query: IAnyObject
query: Record<string, string>
}
interface OnScreenRecordingStateChangedListenerResult {
/** 录屏状态
Expand Down
16 changes: 0 additions & 16 deletions types/wx/lib.wx.app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,6 @@ SOFTWARE.
***************************************************************************** */

declare namespace WechatMiniprogram.App {
interface ReferrerInfo {
/** 来源小程序或公众号或App的 appId
*
* 以下场景支持返回 referrerInfo.appId:
* - 1020(公众号 profile 页相关小程序列表): appId
* - 1035(公众号自定义菜单):来源公众号 appId
* - 1036(App 分享消息卡片):来源应用 appId
* - 1037(小程序打开小程序):来源小程序 appId
* - 1038(从另一个小程序返回):来源小程序 appId
* - 1043(公众号模板消息):来源公众号 appId
*/
appId: string
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
extraData?: any
}

type SceneValues =
| 1000
| 1001
Expand Down

0 comments on commit 7da83ca

Please sign in to comment.