Skip to content

Commit

Permalink
Merge branch 'wechat-miniprogram:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
lv-z-l authored Oct 12, 2024
2 parents dac0a09 + 4e9e50d commit 86a169d
Show file tree
Hide file tree
Showing 6 changed files with 550 additions and 21 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 2024-09-24 v4.0.1
- 更新 API 定义到 3.5.7

## 2024-09-24 v4.0.0
合入 [#332](https://github.com/wechat-miniprogram/api-typings/pull/332), [#333](https://github.com/wechat-miniprogram/api-typings/pull/333), [#334](https://github.com/wechat-miniprogram/api-typings/pull/334) by [@lvzl](https://github.com/lv-z-l)。这几个 Pull Request 对 `Component``Behavior` 的实现进行了较大改动,以支持:
1. 对于 `Array``Object` 类型的 `property``data`,以值的实际类型作为泛型推导的结果,而非固定推导为 `any[]``Record<string, any>`
2. 改变了 `BehaviorIdentifier` 的类型,通过为其交叉一个带有 `Behavior` 定义信息的虚假类型,使 `Component``Behavior` 能自动推导其使用到的 `Behavior``data`, `properties``methods`

这是一个比较大的 **破坏性改动**,从低于 4.0.0 的版本升级时,可能需要进行一些适配:
1. 全局函数 `Component``Behavior` 的第四个泛型现在是新的 `TBehavior`,如果之前的代码中有为这两个函数手动指定泛型的用例,需要手动添加这个泛型;
2. `Behavior()` 的返回值不再是 `string`(或者说不完全是),之前使用 `string` 接受 `Behavior()` 返回值的实现需要修改为 `WechatMiniprogram.Behavior.BehaviorIdentifier`
3. 自定义组件的 `this.data``this.property` 的推导类型可能会有所变化,需要根据推导类型进行响应改动。

## 2024-08-08 v3.12.3
- 更新 API 定义到 3.5.2
- 修复 [#235](https://github.com/wechat-miniprogram/api-typings/issues/235), [#302](https://github.com/wechat-miniprogram/api-typings/issues/302), [#303](https://github.com/wechat-miniprogram/api-typings/issues/303), [#304](https://github.com/wechat-miniprogram/api-typings/issues/304) by [@Yang Mingshan](https://github.com/yangmingshan)
Expand Down
1 change: 1 addition & 0 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Both PR and issue are welcomed for definitions of pages (`Page`), custom compone
- [xieyuhang](https://github.com/haiya6)
- [苏杰豪](https://github.com/Megasu)
- [Yang Mingshan](https://github.com/yangmingshan)
- [lvzl](https://github.com/lv-z-l)

### Automated tests

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ API 的定义文件(`lib.wx.api.d.ts`)是随 [文档](https://developers.wei
- [xieyuhang](https://github.com/haiya6)
- [苏杰豪](https://github.com/Megasu)
- [Yang Mingshan](https://github.com/yangmingshan)
- [lvzl](https://github.com/lv-z-l)

### 测试

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "miniprogram-api-typings",
"version": "3.12.3",
"version": "4.0.1",
"description": "Type definitions for APIs of Wechat Mini Program in TypeScript",
"main": "./index.d.ts",
"types": "./index.d.ts",
Expand Down
Loading

0 comments on commit 86a169d

Please sign in to comment.