Skip to content
This repository has been archived by the owner on Apr 21, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:wechat-miniprogram/api-typings
Browse files Browse the repository at this point in the history
  • Loading branch information
Darmody committed Jan 7, 2020
2 parents 46ea097 + 1428227 commit c7fdc6f
Show file tree
Hide file tree
Showing 14 changed files with 1,154 additions and 540 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 2020-01-07 v2.10.0
- 同步 API 定义到基础库 2.10.0

## 2019-12-20 v2.9.4
- 同步 API 定义到基础库 2.9.4
- 修正一些接口错误(#88#89#91

## 2019-12-06 v2.9.3
- 同步 API 定义到基础库 2.9.3
- 补齐 `Component` 纯数据字段(`pureDataPattern`
- 支持 `Component` 的属性监听器使用 `string` 类型

## 2019-11-14 v2.9.2
- 同步 API 定义到基础库 2.9.2
- 补齐 `Behaviors` 中缺少的一些选项
Expand Down
3 changes: 3 additions & 0 deletions VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

基础库版本|npm 版本|命令
-|-|-
[v2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-10-0-2019-12-24) | [2.10.0](https://www.npmjs.com/package/miniprogram-api-typings/v/2.10.0) | `npm install [email protected]`
[v2.9.4](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-4-2019-11-28) | [2.9.4](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.4) | `npm install [email protected]`
[v2.9.3](https://developers.weixin.qq.com/miniprogram/dev/framework/release/) | [2.9.3](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.3) | `npm install [email protected]`
[v2.9.2](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-2-2019-11-04) | [2.9.2](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.2) | `npm install [email protected]`
[v2.9.1](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-1-2019-10-29) | [2.9.1](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.1) | `npm install [email protected]`
[v2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/release/#v2-9-0-2019-10-09) | [2.9.0](https://www.npmjs.com/package/miniprogram-api-typings/v/2.9.0) | `npm install [email protected]`
Expand Down
716 changes: 358 additions & 358 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"homepage": "https://github.com/remaxjs/api-typings#readme",
"dependencies": {},
"devDependencies": {
"tsd": "^0.9.0",
"tsd": "^0.11.0",
"tslint": "^5.20.0",
"typescript": "^3.5.3"
},
Expand Down
13 changes: 13 additions & 0 deletions test/api_doc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3041,3 +3041,16 @@ import { expectType } from 'tsd'
},
})
}

// Test case from `wx.getSetting`
{
wx.getSetting({
withSubscriptions: true,
success(res) {
expectType<WechatMiniprogram.AuthSetting>(res.authSetting)
expectType<boolean | undefined>(res.authSetting['scope.userInfo'])
expectType<boolean | undefined>(res.authSetting['scope.subscribeMessage'])
expectType<Record<string, any>>(res.subscriptionsSetting)
},
})
}
32 changes: 32 additions & 0 deletions test/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,35 @@ expectError(
},
}),
)

Component({
options: {
pureDataPattern: /^_/,
},
data: {
a: true, // 普通数据字段
_b: true, // 纯数据字段
},
methods: {
myMethod() {
this.data._b // 纯数据字段可以在 this.data 中获取
this.setData({
c: true, // 普通数据字段
_d: true, // 纯数据字段
})
},
},
})

Component({
properties: {
a: {
type: Number,
observer: 'onAChange',
value: 1,
},
},
methods: {
onAChange() {},
},
})
24 changes: 24 additions & 0 deletions test/issue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,27 @@ import WX = WechatMiniprogram
const t: ILoginResult = { code: '', errMsg: '' }
expectType<WechatMiniprogram.LoginSuccessCallbackResult>(t)
}

// https://github.com/wechat-miniprogram/api-typings/issues/88
{
wx.canvasToTempFilePath({ canvas: '#canvas' })
wx.canvasToTempFilePath({ canvasId: '' })
wx.canvasToTempFilePath({ canvas: '', quality: 0.5 })
}

// https://github.com/wechat-miniprogram/api-typings/issues/89
{
const udp = wx.createUDPSocket()
const port = udp.bind()
expectType<number>(port)
}

// https://github.com/wechat-miniprogram/api-typings/issues/91
{
expectType<Record<string, any>>(wx.getExtConfigSync())
wx.getExtConfig({
success(res) {
expectType<Record<string, any>>(res.extConfig)
},
})
}
2 changes: 1 addition & 1 deletion types/wx/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*! *****************************************************************************
Copyright (c) 2019 Tencent, Inc. All rights reserved.
Copyright (c) 2020 Tencent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
Loading

0 comments on commit c7fdc6f

Please sign in to comment.