@tarojs/taro 3.3.10 → 3.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/html5.css +5 -5
  2. package/package.json +5 -5
  3. package/types/api/ad/index.d.ts +34 -28
  4. package/types/api/alipay/index.d.ts +11 -7
  5. package/types/api/base/debug.d.ts +60 -54
  6. package/types/api/base/env.d.ts +12 -8
  7. package/types/api/base/index.d.ts +87 -83
  8. package/types/api/base/system.d.ts +59 -54
  9. package/types/api/base/update.d.ts +37 -33
  10. package/types/api/base/weapp/app-event.d.ts +147 -131
  11. package/types/api/base/weapp/life-cycle.d.ts +14 -10
  12. package/types/api/canvas/index.d.ts +115 -110
  13. package/types/api/cloud/index.d.ts +99 -94
  14. package/types/api/data-analysis/index.d.ts +72 -0
  15. package/types/api/device/accelerometer.d.ts +57 -50
  16. package/types/api/device/battery.d.ts +19 -15
  17. package/types/api/device/ble.d.ts +241 -228
  18. package/types/api/device/bluetooth.d.ts +207 -194
  19. package/types/api/device/clipboard.d.ts +48 -43
  20. package/types/api/device/compass.d.ts +55 -48
  21. package/types/api/device/contact.d.ts +13 -9
  22. package/types/api/device/gyroscope.d.ts +41 -35
  23. package/types/api/device/iBeacon.d.ts +79 -73
  24. package/types/api/device/motion.d.ts +42 -37
  25. package/types/api/device/network.d.ts +48 -42
  26. package/types/api/device/nfc.d.ts +105 -96
  27. package/types/api/device/performance.d.ts +22 -18
  28. package/types/api/device/phone.d.ts +20 -15
  29. package/types/api/device/scan.d.ts +31 -26
  30. package/types/api/device/screen.d.ts +74 -67
  31. package/types/api/device/vibrate.d.ts +31 -25
  32. package/types/api/device/wifi.d.ts +151 -140
  33. package/types/api/ext/index.d.ts +44 -39
  34. package/types/api/files/index.d.ts +219 -209
  35. package/types/api/framework/index.d.ts +25 -20
  36. package/types/api/location/index.d.ts +140 -136
  37. package/types/api/media/audio.d.ts +139 -127
  38. package/types/api/media/background-audio.d.ts +135 -126
  39. package/types/api/media/camera.d.ts +30 -26
  40. package/types/api/media/editor.d.ts +35 -33
  41. package/types/api/media/image.d.ts +190 -137
  42. package/types/api/media/live.d.ts +88 -82
  43. package/types/api/media/map.d.ts +47 -43
  44. package/types/api/media/recorder.d.ts +90 -84
  45. package/types/api/media/video-processing.d.ts +10 -6
  46. package/types/api/media/video.d.ts +63 -58
  47. package/types/api/network/download.d.ts +34 -30
  48. package/types/api/network/mdns.d.ts +104 -91
  49. package/types/api/network/request.d.ts +83 -79
  50. package/types/api/network/udp.d.ts +20 -16
  51. package/types/api/network/upload.d.ts +60 -56
  52. package/types/api/network/websocket.d.ts +201 -194
  53. package/types/api/open-api/account.d.ts +18 -14
  54. package/types/api/open-api/address.d.ts +27 -23
  55. package/types/api/open-api/authorize.d.ts +30 -26
  56. package/types/api/open-api/card.d.ts +55 -51
  57. package/types/api/open-api/customer-service.d.ts +45 -0
  58. package/types/api/open-api/facial.d.ts +28 -24
  59. package/types/api/open-api/invoice.d.ts +38 -34
  60. package/types/api/open-api/login.d.ts +56 -52
  61. package/types/api/open-api/navigate.d.ts +79 -75
  62. package/types/api/open-api/payment.d.ts +34 -30
  63. package/types/api/open-api/settings.d.ts +54 -45
  64. package/types/api/open-api/soter.d.ts +92 -86
  65. package/types/api/open-api/subscribe-message.d.ts +24 -20
  66. package/types/api/open-api/user-info.d.ts +60 -57
  67. package/types/api/open-api/werun.d.ts +50 -46
  68. package/types/api/route/index.d.ts +122 -118
  69. package/types/api/share/index.d.ts +68 -64
  70. package/types/api/storage/background-fetch.d.ts +40 -35
  71. package/types/api/storage/index.d.ts +267 -262
  72. package/types/api/swan/index.d.ts +47 -42
  73. package/types/api/ui/animation.d.ts +21 -17
  74. package/types/api/ui/background.d.ts +38 -34
  75. package/types/api/ui/custom-component.d.ts +22 -18
  76. package/types/api/ui/fonts.d.ts +26 -21
  77. package/types/api/ui/interaction.d.ts +167 -121
  78. package/types/api/ui/keyboard.d.ts +59 -55
  79. package/types/api/ui/menu.d.ts +10 -6
  80. package/types/api/ui/navigation-bar.d.ts +67 -63
  81. package/types/api/ui/pull-down-refresh.d.ts +33 -29
  82. package/types/api/ui/scroll.d.ts +30 -26
  83. package/types/api/ui/sticky.d.ts +22 -19
  84. package/types/api/ui/tab-bar.d.ts +101 -97
  85. package/types/api/ui/window.d.ts +24 -18
  86. package/types/api/worker/index.d.ts +28 -24
  87. package/types/api/wxml/index.d.ts +42 -38
  88. package/types/global.d.ts +350 -0
  89. package/types/index.d.ts +14 -99
  90. package/types/taro.api.d.ts +94 -0
  91. package/types/taro.component.d.ts +10 -57
  92. package/types/taro.config.d.ts +24 -6
  93. package/types/taro.extend.d.ts +70 -67
  94. package/types/taro.hooks.d.ts +68 -67
  95. package/types/taro.lifecycle.d.ts +47 -28
  96. package/types/api/ad/index.ts +0 -6
  97. package/types/api/alipay/index.ts +0 -7
  98. package/types/api/index.d.ts +0 -352
  99. package/types/api/open-api/data-analysis.d.ts +0 -19
  100. package/types/api/open-api/report.d.ts +0 -19
@@ -0,0 +1,350 @@
1
+ declare namespace TaroGeneral {
2
+ type IAnyObject = Record<string, any>
3
+ type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F
4
+ type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }
5
+ /** 事件监听函数 */
6
+ type EventCallback = (
7
+ /** 触发事件参数 */
8
+ ...args: any
9
+ ) => void
10
+ /** 通用错误 */
11
+ interface CallbackResult {
12
+ /** 错误信息 */
13
+ errMsg: string
14
+ }
15
+ type CommonEventFunction<T = any> = (event: BaseEventOrig<T>) => any
16
+ interface BaseEventOrig<T> {
17
+ /** 事件类型 */
18
+ type: string
19
+
20
+ /** 事件生成时的时间戳 */
21
+ timeStamp: number
22
+
23
+ /** 触发事件的组件的一些属性值集合 */
24
+ target: Target
25
+
26
+ /** 当前组件的一些属性值集合 */
27
+ currentTarget: currentTarget
28
+
29
+ /** 额外的信息 */
30
+ detail: T
31
+
32
+ /** 阻止元素发生默认的行为 */
33
+ preventDefault: () => void
34
+
35
+ /** 阻止事件冒泡到父元素,阻止任何父事件处理程序被执行 */
36
+ stopPropagation: () => void
37
+ }
38
+ interface currentTarget extends Target {}
39
+ interface Target {
40
+ /** 事件源组件的id */
41
+ id: string
42
+ /** 当前组件的类型 */
43
+ tagName: string
44
+ /** 事件源组件上由data-开头的自定义属性组成的集合 */
45
+ dataset: {
46
+ [key: string]: any
47
+ }
48
+ }
49
+ /** 蓝牙错误 */
50
+ interface BluetoothError extends CallbackResult {
51
+ /** 错误信息 */
52
+ errMsg: string
53
+ /** 错误码 */
54
+ errCode: keyof BluetoothErrCode
55
+ }
56
+ /** WIFI 错误 */
57
+ interface WifiError extends CallbackResult {
58
+ /** 错误信息 */
59
+ errMsg: string
60
+ /** 错误码 */
61
+ errCode: keyof WifiErrCode
62
+ }
63
+ /** NFC 错误 */
64
+ interface NFCError extends CallbackResult {
65
+ /** 错误信息 */
66
+ errMsg: string
67
+ /** 错误码 */
68
+ errCode: keyof NFCErrCode
69
+ }
70
+
71
+ /** iBeacon 错误 */
72
+ interface IBeaconError extends CallbackResult {
73
+ /** 错误信息 */
74
+ errMsg: string
75
+ /** 错误码 */
76
+ errCode: keyof IBeaconErrCode
77
+ }
78
+
79
+ /** 在竖屏正方向下的安全区域 */
80
+ interface SafeAreaResult {
81
+ /** 安全区域右下角纵坐标 */
82
+ bottom: number
83
+ /** 安全区域的高度,单位逻辑像素 */
84
+ height: number
85
+ /** 安全区域左上角横坐标 */
86
+ left: number
87
+ /** 安全区域右下角横坐标 */
88
+ right: number
89
+ /** 安全区域左上角纵坐标 */
90
+ top: number
91
+ /** 安全区域的宽度,单位逻辑像素 */
92
+ width: number
93
+ }
94
+ /**
95
+ * 广告错误码
96
+ *
97
+ * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
98
+ * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
99
+ */
100
+ interface AdErrCode {
101
+ /**
102
+ * @abnormal 后端接口调用失败
103
+ * @reason 该项错误不是开发者的异常情况
104
+ * @solution 一般情况下忽略一段时间即可恢复。
105
+ */
106
+ 1000
107
+ /**
108
+ * @abnormal 参数错误
109
+ * @reason 使用方法错误
110
+ * @solution 可以前往 developers.weixin.qq.com 确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。
111
+ */
112
+ 1001
113
+ /**
114
+ * @abnormal 广告单元无效
115
+ * @reason 可能是拼写错误、或者误用了其他APP的广告ID
116
+ * @solution 请重新前往 mp.weixin.qq.com 确认广告位ID。
117
+ */
118
+ 1002
119
+ /**
120
+ * @abnormal 内部错误
121
+ * @reason 该项错误不是开发者的异常情况
122
+ * @solution 一般情况下忽略一段时间即可恢复。
123
+ */
124
+ 1003
125
+ /**
126
+ * @abnormal 无合适的广告
127
+ * @reason 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告
128
+ * @solution 属于正常情况,且开发者需要针对这种情况做形态上的兼容。
129
+ */
130
+ 1004
131
+ /**
132
+ * @abnormal 广告组件审核中
133
+ * @reason 你的广告正在被审核,无法展现广告
134
+ * @solution 请前往 mp.weixin.qq.com 确认审核状态,且开发者需要针对这种情况做形态上的兼容。
135
+ */
136
+ 1005
137
+ /**
138
+ * @abnormal 广告组件被驳回
139
+ * @reason 你的广告审核失败,无法展现广告
140
+ * @solution 请前往 mp.weixin.qq.com 确认审核状态,且开发者需要针对这种情况做形态上的兼容。
141
+ */
142
+ 1006
143
+ /**
144
+ * @abnormal 广告组件被封禁
145
+ * @reason 你的广告能力已经被封禁,封禁期间无法展现广告
146
+ * @solution 请前往 mp.weixin.qq.com 确认小程序广告封禁状态。
147
+ */
148
+ 1007
149
+ /**
150
+ * @abnormal 广告单元已关闭
151
+ * @reason 该广告位的广告能力已经被关闭
152
+ * @solution 请前往 mp.weixin.qq.com 重新打开对应广告位的展现。
153
+ */
154
+ 1008
155
+ // [key: number]: string
156
+ }
157
+ /** 蓝牙错误码 */
158
+ interface BluetoothErrCode {
159
+ /** 正常
160
+ * @abnormal ok
161
+ */
162
+ 0
163
+ /** 未初始化蓝牙适配器
164
+ * @abnormal not init
165
+ */
166
+ 10000
167
+ /** 当前蓝牙适配器不可用
168
+ * @abnormal not available
169
+ */
170
+ 10001
171
+ /** 没有找到指定设备
172
+ * @abnormal no device
173
+ */
174
+ 10002
175
+ /** 连接失败
176
+ * @abnormal connection fail
177
+ */
178
+ 10003
179
+ /** 没有找到指定服务
180
+ * @abnormal no service
181
+ */
182
+ 10004
183
+ /** 没有找到指定特征值
184
+ * @abnormal no characteristic
185
+ */
186
+ 10005
187
+ /** 当前连接已断开
188
+ * @abnormal no connection
189
+ */
190
+ 10006
191
+ /** 当前特征值不支持此操作
192
+ * @abnormal property not support
193
+ */
194
+ 10007
195
+ /** 其余所有系统上报的异常
196
+ * @abnormal system error
197
+ */
198
+ 10008
199
+ /** Android 系统特有,系统版本低于 4.3 不支持 BLE
200
+ * @abnormal system not support
201
+ */
202
+ 10009
203
+ /** 连接超时
204
+ * @abnormal operate time out
205
+ */
206
+ 10012
207
+ /** 连接 deviceId 为空或者是格式不正确
208
+ * @abnormal invalid_data
209
+ */
210
+ 10013
211
+ }
212
+ /** iBeacon 错误码 */
213
+ interface IBeaconErrCode {
214
+ /** 正常
215
+ * @abnormal ok
216
+ */
217
+ 0
218
+ /** 系统或设备不支持
219
+ * @abnormal unsupport
220
+ */
221
+ 11000
222
+ /** 蓝牙服务不可用
223
+ * @abnormal bluetooth service unavailable
224
+ */
225
+ 11001
226
+ /** 位置服务不可用
227
+ * @abnormal location service unavailable
228
+ */
229
+ 11002
230
+ /** 已经开始搜索
231
+ * @abnormal already start
232
+ */
233
+ 11003
234
+ /** 还未开始搜索
235
+ * @abnormal not startBeaconDiscovery
236
+ */
237
+ 11004
238
+ /** 系统错误
239
+ * @abnormal system error
240
+ */
241
+ 11005
242
+ /** 参数不正确
243
+ * @abnormal invalid data
244
+ */
245
+ 11006
246
+ }
247
+ /** WIFI 错误码 */
248
+ interface WifiErrCode {
249
+ /** 正常
250
+ * @abnormal ok
251
+ */
252
+ 0
253
+ /** 未先调用 `startWifi` 接口
254
+ * @abnormal not init
255
+ */
256
+ 12000
257
+ /** 当前系统不支持相关能力
258
+ * @abnormal system not support
259
+ */
260
+ 12001
261
+ /** 密码错误
262
+ * @abnormal password error Wi-Fi
263
+ */
264
+ 12002
265
+ /** 连接超时
266
+ * @abnormal connection timeout
267
+ */
268
+ 12003
269
+ /** 重复连接 Wi-Fi
270
+ * @abnormal duplicate request
271
+ */
272
+ 12004
273
+ /** Android 特有,未打开 Wi-Fi 开关
274
+ * @abnormal wifi not turned on
275
+ */
276
+ 12005
277
+ /** Android 特有,未打开 GPS 定位开关
278
+ * @abnormal wifi not turned on
279
+ */
280
+ 12006
281
+ /** 用户拒绝授权链接 Wi-Fi
282
+ * @abnormal user denied
283
+ */
284
+ 12007
285
+ /** 无效 SSID
286
+ * @abnormal invalid SSID
287
+ */
288
+ 12008
289
+ /** 系统运营商配置拒绝连接 Wi-Fi
290
+ * @abnormal system config err
291
+ */
292
+ 12009
293
+ /** 系统其他错误,需要在 errmsg 打印具体的错误原因
294
+ * @abnormal system internal error
295
+ */
296
+ 12010
297
+ /** 应用在后台无法配置 Wi-Fi
298
+ * @abnormal weapp in background
299
+ */
300
+ 12011
301
+ /** 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试
302
+ * @abnormal wifi config may be expired
303
+ */
304
+ 12013
305
+ }
306
+ /** NFC 错误码 */
307
+ interface NFCErrCode {
308
+ /** 正常
309
+ * @abnormal ok
310
+ */
311
+ 0
312
+ /** 当前设备不支持NFC */
313
+ 13000
314
+ /** 当前设备支持NFC,但系统NFC开关未开启 */
315
+ 13001
316
+ /** 当前设备支持NFC,但不支持HCE */
317
+ 13002
318
+ /** AID列表参数格式错误 */
319
+ 13003
320
+ /** 未设置微信为默认NFC支付应用 */
321
+ 13004
322
+ /** 返回的指令不合法 */
323
+ 13005
324
+ /** 注册AID失败 */
325
+ 13006
326
+ }
327
+
328
+ /** 启动参数 */
329
+ interface LaunchOptionsApp {
330
+ /** 启动小程序的路径 */
331
+ path: string
332
+ /** 启动小程序的 query 参数 */
333
+ query: IAnyObject
334
+ /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
335
+ referrerInfo: LaunchOptionsApp.ReferrerInfo
336
+ /** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
337
+ scene: number
338
+ /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
339
+ shareTicket: string
340
+ }
341
+
342
+ namespace LaunchOptionsApp {
343
+ interface ReferrerInfo {
344
+ /** 来源小程序、公众号或 App 的 appId */
345
+ appId: string
346
+ /** 来源小程序传过来的数据,scene=1037或1038时支持 */
347
+ extraData: IAnyObject
348
+ }
349
+ }
350
+ }
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Taro 类型定义文件
3
- *
3
+ *
4
4
  * 目录结构
5
5
  * ├── api 小程序端能力 API
6
6
  * │ ├── ad
@@ -81,6 +81,7 @@
81
81
  * │ │ ├── soter.d.ts 开放接口 -> 生物认证 API
82
82
  * | | ├── subscribe-message.d.ts 开放接口 -> 订阅消息 API
83
83
  * │ │ ├── user-info.d.ts 开放接口 -> 用户信息 API
84
+ * │ │ ├── customer-service.d.ts 开放接口 -> 微信客服 API
84
85
  * │ │ └── werun.d.ts 开放接口 -> 微信运动 API
85
86
  * │ ├── route
86
87
  * │ │ └── index.d.ts 路由 API
@@ -117,107 +118,21 @@
117
118
  * └── taro.lifecycle.d.ts Taro 生命周期类型定义
118
119
  */
119
120
 
120
- /// <reference path="taro.lifecycle.d.ts" />
121
+ /// <reference path="global.d.ts" />
122
+
123
+ /// <reference path="taro.api.d.ts" />
121
124
  /// <reference path="taro.component.d.ts" />
122
- /// <reference path="taro.hooks.d.ts" />
123
125
  /// <reference path="taro.config.d.ts" />
124
126
  /// <reference path="taro.extend.d.ts" />
127
+ /// <reference path="taro.hooks.d.ts" />
128
+ /// <reference path="taro.lifecycle.d.ts" />
125
129
 
126
- /// <reference path="api/index.d.ts" />
127
-
128
- /**
129
- *
130
- * 微信端能力
131
- * original code from: https://github.com/wx-minapp/minapp-wx/blob/master/typing/wx.d.ts
132
- * Lincenced under MIT license: https://github.com/qiu8310/minapp/issues/69
133
- * thanks for the great work by @qiu8310 👍👍👍
134
- *
135
- */
136
- /// <reference path="api/ad/index.d.ts" />
137
- /// <reference path="api/base/index.d.ts" />
138
- /// <reference path="api/base/debug.d.ts" />
139
- /// <reference path="api/base/system.d.ts" />
140
- /// <reference path="api/base/update.d.ts" />
141
- /// <reference path="api/base/weapp/life-cycle.d.ts" />
142
- /// <reference path="api/base/weapp/app-event.d.ts" />
143
- /// <reference path="api/base/env.d.ts" />
144
- /// <reference path="api/canvas/index.d.ts" />
145
- /// <reference path="api/cloud/index.d.ts" />
146
- /// <reference path="api/device/accelerometer.d.ts" />
147
- /// <reference path="api/device/battery.d.ts" />
148
- /// <reference path="api/device/ble.d.ts" />
149
- /// <reference path="api/device/bluetooth.d.ts" />
150
- /// <reference path="api/device/clipboard.d.ts" />
151
- /// <reference path="api/device/compass.d.ts" />
152
- /// <reference path="api/device/contact.d.ts" />
153
- /// <reference path="api/device/gyroscope.d.ts" />
154
- /// <reference path="api/device/iBeacon.d.ts" />
155
- /// <reference path="api/device/motion.d.ts" />
156
- /// <reference path="api/device/network.d.ts" />
157
- /// <reference path="api/device/nfc.d.ts" />
158
- /// <reference path="api/device/performance.d.ts" />
159
- /// <reference path="api/device/phone.d.ts" />
160
- /// <reference path="api/device/scan.d.ts" />
161
- /// <reference path="api/device/screen.d.ts" />
162
- /// <reference path="api/device/vibrate.d.ts" />
163
- /// <reference path="api/device/wifi.d.ts" />
164
- /// <reference path="api/ext/index.d.ts" />
165
- /// <reference path="api/files/index.d.ts" />
166
- /// <reference path="api/framework/index.d.ts" />
167
- /// <reference path="api/location/index.d.ts" />
168
- /// <reference path="api/media/audio.d.ts" />
169
- /// <reference path="api/media/background-audio.d.ts" />
170
- /// <reference path="api/media/camera.d.ts" />
171
- /// <reference path="api/media/editor.d.ts" />
172
- /// <reference path="api/media/image.d.ts" />
173
- /// <reference path="api/media/live.d.ts" />
174
- /// <reference path="api/media/map.d.ts" />
175
- /// <reference path="api/media/recorder.d.ts" />
176
- /// <reference path="api/media/video.d.ts" />
177
- /// <reference path="api/media/video-processing.d.ts" />
178
- /// <reference path="api/network/download.d.ts" />
179
- /// <reference path="api/network/mdns.d.ts" />
180
- /// <reference path="api/network/request.d.ts" />
181
- /// <reference path="api/network/udp.d.ts" />
182
- /// <reference path="api/network/upload.d.ts" />
183
- /// <reference path="api/network/websocket.d.ts" />
184
- /// <reference path="api/open-api/account.d.ts" />
185
- /// <reference path="api/open-api/address.d.ts" />
186
- /// <reference path="api/open-api/authorize.d.ts" />
187
- /// <reference path="api/open-api/card.d.ts" />
188
- /// <reference path="api/open-api/data-analysis.d.ts" />
189
- /// <reference path="api/open-api/facial.d.ts" />
190
- /// <reference path="api/open-api/invoice.d.ts" />
191
- /// <reference path="api/open-api/login.d.ts" />
192
- /// <reference path="api/open-api/navigate.d.ts" />
193
- /// <reference path="api/open-api/payment.d.ts" />
194
- /// <reference path="api/open-api/report.d.ts" />
195
- /// <reference path="api/open-api/settings.d.ts" />
196
- /// <reference path="api/open-api/soter.d.ts" />
197
- /// <reference path="api/open-api/subscribe-message.d.ts" />
198
- /// <reference path="api/open-api/user-info.d.ts" />
199
- /// <reference path="api/open-api/werun.d.ts" />
200
- /// <reference path="api/route/index.d.ts" />
201
- /// <reference path="api/share/index.d.ts" />
202
- /// <reference path="api/storage/background-fetch.d.ts" />
203
- /// <reference path="api/storage/index.d.ts" />
204
- /// <reference path="api/ui/animation.d.ts" />
205
- /// <reference path="api/ui/background.d.ts" />
206
- /// <reference path="api/ui/custom-component.d.ts" />
207
- /// <reference path="api/ui/fonts.d.ts" />
208
- /// <reference path="api/ui/keyboard.d.ts" />
209
- /// <reference path="api/ui/menu.d.ts" />
210
- /// <reference path="api/ui/navigation-bar.d.ts" />
211
- /// <reference path="api/ui/pull-down-refresh.d.ts" />
212
- /// <reference path="api/ui/scroll.d.ts" />
213
- /// <reference path="api/ui/sticky.d.ts" />
214
- /// <reference path="api/ui/tab-bar.d.ts" />
215
- /// <reference path="api/ui/window.d.ts" />
216
- /// <reference path="api/ui/interaction.d.ts" />
217
- /// <reference path="api/worker/index.d.ts" />
218
- /// <reference path="api/wxml/index.d.ts" />
130
+ export = Taro
131
+ export as namespace Taro
219
132
 
220
- /// <reference path="api/alipay/index.d.ts" />
221
- /// <reference path="api/swan/index.d.ts" />
133
+ declare const Taro: Taro.TaroStatic
222
134
 
223
- export = Taro
135
+ declare namespace Taro {
136
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
137
+ interface TaroStatic {}
138
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ *
3
+ * 微信端能力
4
+ * original code from: https://github.com/wx-minapp/minapp-wx/blob/master/typing/wx.d.ts
5
+ * Lincenced under MIT license: https://github.com/qiu8310/minapp/issues/69
6
+ * thanks for the great work by @qiu8310 👍👍👍
7
+ *
8
+ */
9
+ /// <reference path="api/ad/index.d.ts" />
10
+ /// <reference path="api/base/index.d.ts" />
11
+ /// <reference path="api/base/debug.d.ts" />
12
+ /// <reference path="api/base/system.d.ts" />
13
+ /// <reference path="api/base/update.d.ts" />
14
+ /// <reference path="api/base/weapp/life-cycle.d.ts" />
15
+ /// <reference path="api/base/weapp/app-event.d.ts" />
16
+ /// <reference path="api/base/env.d.ts" />
17
+ /// <reference path="api/canvas/index.d.ts" />
18
+ /// <reference path="api/cloud/index.d.ts" />
19
+ /// <reference path="api/data-analysis/index.d.ts" />
20
+ /// <reference path="api/device/accelerometer.d.ts" />
21
+ /// <reference path="api/device/battery.d.ts" />
22
+ /// <reference path="api/device/ble.d.ts" />
23
+ /// <reference path="api/device/bluetooth.d.ts" />
24
+ /// <reference path="api/device/clipboard.d.ts" />
25
+ /// <reference path="api/device/compass.d.ts" />
26
+ /// <reference path="api/device/contact.d.ts" />
27
+ /// <reference path="api/device/gyroscope.d.ts" />
28
+ /// <reference path="api/device/iBeacon.d.ts" />
29
+ /// <reference path="api/device/motion.d.ts" />
30
+ /// <reference path="api/device/network.d.ts" />
31
+ /// <reference path="api/device/nfc.d.ts" />
32
+ /// <reference path="api/device/performance.d.ts" />
33
+ /// <reference path="api/device/phone.d.ts" />
34
+ /// <reference path="api/device/scan.d.ts" />
35
+ /// <reference path="api/device/screen.d.ts" />
36
+ /// <reference path="api/device/vibrate.d.ts" />
37
+ /// <reference path="api/device/wifi.d.ts" />
38
+ /// <reference path="api/ext/index.d.ts" />
39
+ /// <reference path="api/files/index.d.ts" />
40
+ /// <reference path="api/framework/index.d.ts" />
41
+ /// <reference path="api/location/index.d.ts" />
42
+ /// <reference path="api/media/audio.d.ts" />
43
+ /// <reference path="api/media/background-audio.d.ts" />
44
+ /// <reference path="api/media/camera.d.ts" />
45
+ /// <reference path="api/media/editor.d.ts" />
46
+ /// <reference path="api/media/image.d.ts" />
47
+ /// <reference path="api/media/live.d.ts" />
48
+ /// <reference path="api/media/map.d.ts" />
49
+ /// <reference path="api/media/recorder.d.ts" />
50
+ /// <reference path="api/media/video.d.ts" />
51
+ /// <reference path="api/media/video-processing.d.ts" />
52
+ /// <reference path="api/network/download.d.ts" />
53
+ /// <reference path="api/network/mdns.d.ts" />
54
+ /// <reference path="api/network/request.d.ts" />
55
+ /// <reference path="api/network/udp.d.ts" />
56
+ /// <reference path="api/network/upload.d.ts" />
57
+ /// <reference path="api/network/websocket.d.ts" />
58
+ /// <reference path="api/open-api/account.d.ts" />
59
+ /// <reference path="api/open-api/address.d.ts" />
60
+ /// <reference path="api/open-api/authorize.d.ts" />
61
+ /// <reference path="api/open-api/card.d.ts" />
62
+ /// <reference path="api/open-api/facial.d.ts" />
63
+ /// <reference path="api/open-api/invoice.d.ts" />
64
+ /// <reference path="api/open-api/login.d.ts" />
65
+ /// <reference path="api/open-api/navigate.d.ts" />
66
+ /// <reference path="api/open-api/payment.d.ts" />
67
+ /// <reference path="api/open-api/settings.d.ts" />
68
+ /// <reference path="api/open-api/soter.d.ts" />
69
+ /// <reference path="api/open-api/subscribe-message.d.ts" />
70
+ /// <reference path="api/open-api/user-info.d.ts" />
71
+ /// <reference path="api/open-api/werun.d.ts" />
72
+ /// <reference path="api/open-api/customer-service.d.ts" />
73
+ /// <reference path="api/route/index.d.ts" />
74
+ /// <reference path="api/share/index.d.ts" />
75
+ /// <reference path="api/storage/background-fetch.d.ts" />
76
+ /// <reference path="api/storage/index.d.ts" />
77
+ /// <reference path="api/ui/animation.d.ts" />
78
+ /// <reference path="api/ui/background.d.ts" />
79
+ /// <reference path="api/ui/custom-component.d.ts" />
80
+ /// <reference path="api/ui/fonts.d.ts" />
81
+ /// <reference path="api/ui/keyboard.d.ts" />
82
+ /// <reference path="api/ui/menu.d.ts" />
83
+ /// <reference path="api/ui/navigation-bar.d.ts" />
84
+ /// <reference path="api/ui/pull-down-refresh.d.ts" />
85
+ /// <reference path="api/ui/scroll.d.ts" />
86
+ /// <reference path="api/ui/sticky.d.ts" />
87
+ /// <reference path="api/ui/tab-bar.d.ts" />
88
+ /// <reference path="api/ui/window.d.ts" />
89
+ /// <reference path="api/ui/interaction.d.ts" />
90
+ /// <reference path="api/worker/index.d.ts" />
91
+ /// <reference path="api/wxml/index.d.ts" />
92
+
93
+ /// <reference path="api/alipay/index.d.ts" />
94
+ /// <reference path="api/swan/index.d.ts" />
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  /// <reference types="vue" />
3
- /// <reference path="taro.lifecycle.d.ts" />
4
- /// <reference path="taro.config.d.ts" />
5
3
 
6
- declare namespace Taro {
4
+ import Taro, { ComponentOptions, Config, RouterInfo } from './index'
5
+
6
+ declare module './index' {
7
7
  // Components
8
8
  interface ComponentLifecycle<P, S, SS = any> extends NewLifecycle<P, S, SS> {
9
9
  componentWillMount?(): void
@@ -60,53 +60,6 @@ declare namespace Taro {
60
60
  $scope?: any
61
61
  }
62
62
 
63
- class Component<P, S> {
64
- constructor(props?: Readonly<P>)
65
- /**
66
- * @deprecated
67
- * @see https://reactjs.org/docs/legacy-context.html
68
- */
69
- constructor(props?: P, context?: any)
70
-
71
- config?: Config
72
-
73
- options?: ComponentOptions
74
-
75
- $componentType: 'PAGE' | 'COMPONENT'
76
-
77
- $router: RouterInfo
78
-
79
- $preloadData: any
80
-
81
- /**
82
- * 使用 `this.$preload` 函数进行页面跳转传参
83
- * @example this.$preload('key', 'val');
84
- * @example this.$preload({
85
- x: 1,
86
- y: 2
87
- });
88
- * @see https://nervjs.github.io/taro/docs/best-practice.html
89
- */
90
- $preload(key: string, value: any): void
91
- $preload(key: object): void
92
-
93
- setState<K extends keyof S>(
94
- state: ((prevState: Readonly<S>, props: P) => Pick<S, K> | S) | (Pick<S, K> | S),
95
- callback?: () => any
96
- ): void
97
-
98
- forceUpdate(callBack?: () => any): void
99
-
100
- render(): React.ReactNode
101
-
102
- readonly props: Readonly<P> & Readonly<{ children?: React.ReactNode }>
103
- state: Readonly<S>
104
- context: any
105
- refs: {
106
- [key: string]: any
107
- }
108
- }
109
-
110
63
  type PropsWithChildren<P> = P & { children?: React.ReactNode }
111
64
 
112
65
  interface FunctionComponent<P = {}> {
@@ -126,13 +79,6 @@ declare namespace Taro {
126
79
 
127
80
  type SFC = StatelessFunctionComponent
128
81
 
129
- class PureComponent<P = {}, S = {}> extends Component<P, S> {}
130
-
131
- function memo<P = {}>(
132
- FunctionComponent: FunctionComponent<P>,
133
- compare?: (oldProps: P, newProps: P) => Boolean
134
- ): FunctionComponent<P>
135
-
136
82
  interface Show {
137
83
  componentDidShow?(options?: unknown): void
138
84
  componentDidHide?(options?: unknown): void
@@ -208,4 +154,11 @@ declare namespace Taro {
208
154
  **/
209
155
  clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void
210
156
  }
157
+
158
+ interface TaroStatic {
159
+ memo<P = {}>(
160
+ FunctionComponent: FunctionComponent<P>,
161
+ compare?: (oldProps: P, newProps: P) => Boolean
162
+ ): FunctionComponent<P>
163
+ }
211
164
  }