@tarojs/taro 3.3.13 → 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 (97) hide show
  1. package/package.json +5 -5
  2. package/types/api/ad/index.d.ts +34 -28
  3. package/types/api/alipay/index.d.ts +11 -7
  4. package/types/api/base/debug.d.ts +60 -54
  5. package/types/api/base/env.d.ts +12 -8
  6. package/types/api/base/index.d.ts +87 -83
  7. package/types/api/base/system.d.ts +59 -54
  8. package/types/api/base/update.d.ts +37 -33
  9. package/types/api/base/weapp/app-event.d.ts +147 -131
  10. package/types/api/base/weapp/life-cycle.d.ts +14 -10
  11. package/types/api/canvas/index.d.ts +115 -110
  12. package/types/api/cloud/index.d.ts +99 -94
  13. package/types/api/data-analysis/index.d.ts +68 -64
  14. package/types/api/device/accelerometer.d.ts +57 -50
  15. package/types/api/device/battery.d.ts +19 -15
  16. package/types/api/device/ble.d.ts +241 -228
  17. package/types/api/device/bluetooth.d.ts +207 -194
  18. package/types/api/device/clipboard.d.ts +48 -43
  19. package/types/api/device/compass.d.ts +55 -48
  20. package/types/api/device/contact.d.ts +13 -9
  21. package/types/api/device/gyroscope.d.ts +41 -35
  22. package/types/api/device/iBeacon.d.ts +79 -73
  23. package/types/api/device/motion.d.ts +42 -37
  24. package/types/api/device/network.d.ts +48 -42
  25. package/types/api/device/nfc.d.ts +105 -96
  26. package/types/api/device/performance.d.ts +22 -18
  27. package/types/api/device/phone.d.ts +20 -15
  28. package/types/api/device/scan.d.ts +31 -26
  29. package/types/api/device/screen.d.ts +74 -67
  30. package/types/api/device/vibrate.d.ts +31 -25
  31. package/types/api/device/wifi.d.ts +151 -140
  32. package/types/api/ext/index.d.ts +44 -39
  33. package/types/api/files/index.d.ts +219 -209
  34. package/types/api/framework/index.d.ts +25 -20
  35. package/types/api/location/index.d.ts +140 -136
  36. package/types/api/media/audio.d.ts +135 -127
  37. package/types/api/media/background-audio.d.ts +135 -126
  38. package/types/api/media/camera.d.ts +30 -26
  39. package/types/api/media/editor.d.ts +35 -33
  40. package/types/api/media/image.d.ts +161 -150
  41. package/types/api/media/live.d.ts +88 -82
  42. package/types/api/media/map.d.ts +47 -43
  43. package/types/api/media/recorder.d.ts +90 -84
  44. package/types/api/media/video-processing.d.ts +10 -6
  45. package/types/api/media/video.d.ts +63 -58
  46. package/types/api/network/download.d.ts +34 -30
  47. package/types/api/network/mdns.d.ts +104 -91
  48. package/types/api/network/request.d.ts +83 -79
  49. package/types/api/network/udp.d.ts +20 -16
  50. package/types/api/network/upload.d.ts +60 -56
  51. package/types/api/network/websocket.d.ts +201 -194
  52. package/types/api/open-api/account.d.ts +18 -14
  53. package/types/api/open-api/address.d.ts +27 -23
  54. package/types/api/open-api/authorize.d.ts +30 -26
  55. package/types/api/open-api/card.d.ts +55 -51
  56. package/types/api/open-api/customer-service.d.ts +21 -17
  57. package/types/api/open-api/facial.d.ts +28 -24
  58. package/types/api/open-api/invoice.d.ts +38 -34
  59. package/types/api/open-api/login.d.ts +56 -52
  60. package/types/api/open-api/navigate.d.ts +79 -75
  61. package/types/api/open-api/payment.d.ts +34 -30
  62. package/types/api/open-api/settings.d.ts +49 -45
  63. package/types/api/open-api/soter.d.ts +92 -86
  64. package/types/api/open-api/subscribe-message.d.ts +24 -20
  65. package/types/api/open-api/user-info.d.ts +60 -57
  66. package/types/api/open-api/werun.d.ts +50 -46
  67. package/types/api/route/index.d.ts +122 -118
  68. package/types/api/share/index.d.ts +68 -64
  69. package/types/api/storage/background-fetch.d.ts +40 -35
  70. package/types/api/storage/index.d.ts +267 -262
  71. package/types/api/swan/index.d.ts +47 -42
  72. package/types/api/ui/animation.d.ts +21 -17
  73. package/types/api/ui/background.d.ts +38 -34
  74. package/types/api/ui/custom-component.d.ts +22 -18
  75. package/types/api/ui/fonts.d.ts +26 -21
  76. package/types/api/ui/interaction.d.ts +153 -149
  77. package/types/api/ui/keyboard.d.ts +59 -55
  78. package/types/api/ui/menu.d.ts +10 -6
  79. package/types/api/ui/navigation-bar.d.ts +67 -63
  80. package/types/api/ui/pull-down-refresh.d.ts +33 -29
  81. package/types/api/ui/scroll.d.ts +30 -26
  82. package/types/api/ui/sticky.d.ts +22 -19
  83. package/types/api/ui/tab-bar.d.ts +101 -97
  84. package/types/api/ui/window.d.ts +24 -18
  85. package/types/api/worker/index.d.ts +28 -24
  86. package/types/api/wxml/index.d.ts +42 -38
  87. package/types/global.d.ts +350 -0
  88. package/types/index.d.ts +12 -98
  89. package/types/taro.api.d.ts +94 -0
  90. package/types/taro.component.d.ts +10 -57
  91. package/types/taro.config.d.ts +24 -6
  92. package/types/taro.extend.d.ts +70 -67
  93. package/types/taro.hooks.d.ts +68 -67
  94. package/types/taro.lifecycle.d.ts +47 -28
  95. package/types/api/ad/index.ts +0 -6
  96. package/types/api/alipay/index.ts +0 -7
  97. package/types/api/index.d.ts +0 -352
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace onNetworkStatusChange {
3
5
  /** 网络状态变化事件的回调函数 */
4
6
  type Callback = (
@@ -12,32 +14,17 @@ declare namespace Taro {
12
14
  networkType: keyof getNetworkType.networkType
13
15
  }
14
16
  }
15
- /** 监听网络状态变化。
16
- * @supported weapp, h5, rn
17
- * @example
18
- * ```tsx
19
- * Taro.onNetworkStatusChange(function (res) {
20
- * console.log(res.isConnected)
21
- * console.log(res.networkType)
22
- * })
23
- * ```
24
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html
25
- */
26
- function onNetworkStatusChange(
27
- /** 网络状态变化事件的回调函数 */
28
- callback: onNetworkStatusChange.Callback,
29
- ): void
30
17
 
31
18
  namespace getNetworkType {
32
19
  interface Option {
33
20
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
34
- complete?: (res: General.CallbackResult) => void
21
+ complete?: (res: TaroGeneral.CallbackResult) => void
35
22
  /** 接口调用失败的回调函数 */
36
- fail?: (res: General.CallbackResult) => void
23
+ fail?: (res: TaroGeneral.CallbackResult) => void
37
24
  /** 接口调用成功的回调函数 */
38
25
  success?: (result: SuccessCallbackResult) => void
39
26
  }
40
- interface SuccessCallbackResult extends General.CallbackResult {
27
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
41
28
  /** 网络类型 */
42
29
  networkType: keyof networkType
43
30
  /** 调用结果 */
@@ -60,28 +47,47 @@ declare namespace Taro {
60
47
  'none'
61
48
  }
62
49
  }
63
- /** 获取网络类型。
64
- * @supported weapp, h5, rn
65
- * @example
66
- * ```tsx
67
- * Taro.getNetworkType({
68
- * success: function (res)) {
69
- * // 返回网络类型, 有效值:
70
- * // wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
71
- * var networkType = res.networkType
72
- * }
73
- * })
74
- * ```
75
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html
76
- */
77
- function getNetworkType(option?: getNetworkType.Option): Promise<getNetworkType.SuccessCallbackResult>
78
50
 
79
- /** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
80
- * @supported weapp
81
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html
82
- */
83
- function offNetworkStatusChange(
84
- /** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听 */
85
- callback?: (...args: any[]) => any,
86
- ): void
51
+ interface TaroStatic {
52
+ /** 监听网络状态变化。
53
+ * @supported weapp, h5, rn
54
+ * @example
55
+ * ```tsx
56
+ * Taro.onNetworkStatusChange(function (res) {
57
+ * console.log(res.isConnected)
58
+ * console.log(res.networkType)
59
+ * })
60
+ * ```
61
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html
62
+ */
63
+ onNetworkStatusChange(
64
+ /** 网络状态变化事件的回调函数 */
65
+ callback: onNetworkStatusChange.Callback,
66
+ ): void
67
+
68
+ /** 获取网络类型。
69
+ * @supported weapp, h5, rn
70
+ * @example
71
+ * ```tsx
72
+ * Taro.getNetworkType({
73
+ * success: function (res)) {
74
+ * // 返回网络类型, 有效值:
75
+ * // wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
76
+ * var networkType = res.networkType
77
+ * }
78
+ * })
79
+ * ```
80
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html
81
+ */
82
+ getNetworkType(option?: getNetworkType.Option): Promise<getNetworkType.SuccessCallbackResult>
83
+
84
+ /** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
85
+ * @supported weapp
86
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html
87
+ */
88
+ offNetworkStatusChange(
89
+ /** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听 */
90
+ callback?: (...args: any[]) => any,
91
+ ): void
92
+ }
87
93
  }
@@ -1,90 +1,42 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace stopHCE {
3
5
  interface Option {
4
6
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
5
- complete?: (res: General.NFCError) => void
7
+ complete?: (res: TaroGeneral.NFCError) => void
6
8
  /** 接口调用失败的回调函数 */
7
- fail?: (res: General.NFCError) => void
9
+ fail?: (res: TaroGeneral.NFCError) => void
8
10
  /** 接口调用成功的回调函数 */
9
- success?: (res: General.NFCError) => void
11
+ success?: (res: TaroGeneral.NFCError) => void
10
12
  }
11
13
  }
12
- /**
13
- * 关闭 NFC 模块。仅在安卓系统下有效。
14
- * @supported weapp
15
- * @example
16
- * ```tsx
17
- * Taro.stopHCE({
18
- * success: function (res) {
19
- * console.log(res.errMsg)
20
- * }
21
- * })
22
- * ```
23
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.stopHCE.html
24
- */
25
- function stopHCE(option?: stopHCE.Option): Promise<General.NFCError>
26
14
 
27
15
  namespace startHCE {
28
16
  interface Option {
29
17
  /** 需要注册到系统的 AID 列表 */
30
18
  aid_list: string[]
31
19
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
32
- complete?: (res: General.NFCError) => void
20
+ complete?: (res: TaroGeneral.NFCError) => void
33
21
  /** 接口调用失败的回调函数 */
34
- fail?: (res: General.NFCError) => void
22
+ fail?: (res: TaroGeneral.NFCError) => void
35
23
  /** 接口调用成功的回调函数 */
36
- success?: (res: General.NFCError) => void
37
- }
24
+ success?: (res: TaroGeneral.NFCError) => void
25
+ }
38
26
  }
39
- /**
40
- * 初始化 NFC 模块。
41
- * @supported weapp
42
- * @example
43
- * ```tsx
44
- * Taro.startHCE({
45
- * aid_list: ['F222222222']
46
- * success: function (res) {
47
- * console.log(res.errMsg)
48
- * }
49
- * })
50
- * ```
51
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.startHCE.html
52
- */
53
- function startHCE(option: startHCE.Option): Promise<General.NFCError>
54
27
 
55
28
  namespace sendHCEMessage {
56
29
  interface Option {
57
30
  /** 二进制数据 */
58
31
  data: ArrayBuffer
59
32
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
60
- complete?: (res: General.NFCError) => void
33
+ complete?: (res: TaroGeneral.NFCError) => void
61
34
  /** 接口调用失败的回调函数 */
62
- fail?: (res: General.NFCError) => void
35
+ fail?: (res: TaroGeneral.NFCError) => void
63
36
  /** 接口调用成功的回调函数 */
64
- success?: (res: General.NFCError) => void
37
+ success?: (res: TaroGeneral.NFCError) => void
65
38
  }
66
39
  }
67
- /**
68
- * 发送 NFC 消息。仅在安卓系统下有效。
69
- * @supported weapp
70
- * @example
71
- * ```tsx
72
- * const buffer = new ArrayBuffer(1)
73
- * const dataView = new DataView(buffer)
74
- * dataView.setUint8(0, 0)
75
- * Taro.startHCE({
76
- * success: function (res) {
77
- * Taro.onHCEMessage(function (res) {
78
- * if (res.messageType === 1) {
79
- * Taro.sendHCEMessage({data: buffer})
80
- * }
81
- * })
82
- * }
83
- * })
84
- * ```
85
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.sendHCEMessage.html
86
- */
87
- function sendHCEMessage(option: sendHCEMessage.Option): Promise<General.NFCError>
88
40
 
89
41
  namespace onHCEMessage {
90
42
  /** 接收 NFC 设备消息事件的回调函数 */
@@ -107,47 +59,104 @@ declare namespace Taro {
107
59
  2
108
60
  }
109
61
  }
110
- /**
111
- * 监听接收 NFC 设备消息事件,仅能注册一个监听
112
- * @supported weapp
113
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.onHCEMessage.html
114
- */
115
- function onHCEMessage(
116
- /** 接收 NFC 设备消息事件的回调函数 */
117
- callback: onHCEMessage.Callback,
118
- ): void
119
62
 
120
63
  namespace getHCEState {
121
64
  interface Option {
122
65
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
123
- complete?: (res: General.NFCError) => void
66
+ complete?: (res: TaroGeneral.NFCError) => void
124
67
  /** 接口调用失败的回调函数 */
125
- fail?: (res: General.NFCError) => void
68
+ fail?: (res: TaroGeneral.NFCError) => void
126
69
  /** 接口调用成功的回调函数 */
127
- success?: (res: General.NFCError) => void
128
- }
70
+ success?: (res: TaroGeneral.NFCError) => void
71
+ }
129
72
  }
130
- /**
131
- * 判断当前设备是否支持 HCE 能力。
132
- * @supported weapp
133
- * @example
134
- * ```tsx
135
- * Taro.getHCEState({
136
- * success: function (res) {
137
- * console.log(res.errCode)
138
- * }
139
- * })
140
- * ```
141
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getHCEState.html
142
- */
143
- function getHCEState(option?: getHCEState.Option): Promise<General.NFCError>
144
73
 
145
- /** 接收 NFC 设备消息事件,取消事件监听。
146
- * @supported weapp
147
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.offHCEMessage.html
148
- */
149
- function offHCEMessage(
150
- /** 接收 NFC 设备消息事件的回调函数 */
151
- callback: (...args: any[]) => any,
152
- ): void
74
+ interface TaroStatic {
75
+ /**
76
+ * 关闭 NFC 模块。仅在安卓系统下有效。
77
+ * @supported weapp
78
+ * @example
79
+ * ```tsx
80
+ * Taro.stopHCE({
81
+ * success: function (res) {
82
+ * console.log(res.errMsg)
83
+ * }
84
+ * })
85
+ * ```
86
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.stopHCE.html
87
+ */
88
+ stopHCE(option?: stopHCE.Option): Promise<TaroGeneral.NFCError>
89
+
90
+ /**
91
+ * 初始化 NFC 模块。
92
+ * @supported weapp
93
+ * @example
94
+ * ```tsx
95
+ * Taro.startHCE({
96
+ * aid_list: ['F222222222']
97
+ * success: function (res) {
98
+ * console.log(res.errMsg)
99
+ * }
100
+ * })
101
+ * ```
102
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.startHCE.html
103
+ */
104
+ startHCE(option: startHCE.Option): Promise<TaroGeneral.NFCError>
105
+
106
+ /**
107
+ * 发送 NFC 消息。仅在安卓系统下有效。
108
+ * @supported weapp
109
+ * @example
110
+ * ```tsx
111
+ * const buffer = new ArrayBuffer(1)
112
+ * const dataView = new DataView(buffer)
113
+ * dataView.setUint8(0, 0)
114
+ * Taro.startHCE({
115
+ * success: function (res) {
116
+ * Taro.onHCEMessage(function (res) {
117
+ * if (res.messageType === 1) {
118
+ * Taro.sendHCEMessage({data: buffer})
119
+ * }
120
+ * })
121
+ * }
122
+ * })
123
+ * ```
124
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.sendHCEMessage.html
125
+ */
126
+ sendHCEMessage(option: sendHCEMessage.Option): Promise<TaroGeneral.NFCError>
127
+
128
+ /**
129
+ * 监听接收 NFC 设备消息事件,仅能注册一个监听
130
+ * @supported weapp
131
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.onHCEMessage.html
132
+ */
133
+ onHCEMessage(
134
+ /** 接收 NFC 设备消息事件的回调函数 */
135
+ callback: onHCEMessage.Callback,
136
+ ): void
137
+
138
+ /**
139
+ * 判断当前设备是否支持 HCE 能力。
140
+ * @supported weapp
141
+ * @example
142
+ * ```tsx
143
+ * Taro.getHCEState({
144
+ * success: function (res) {
145
+ * console.log(res.errCode)
146
+ * }
147
+ * })
148
+ * ```
149
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getHCEState.html
150
+ */
151
+ getHCEState(option?: getHCEState.Option): Promise<TaroGeneral.NFCError>
152
+
153
+ /** 接收 NFC 设备消息事件,取消事件监听。
154
+ * @supported weapp
155
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.offHCEMessage.html
156
+ */
157
+ offHCEMessage(
158
+ /** 接收 NFC 设备消息事件的回调函数 */
159
+ callback: (...args: any[]) => any,
160
+ ): void
161
+ }
153
162
  }
@@ -1,21 +1,6 @@
1
- declare namespace Taro {
2
- /** 监听内存不足告警事件。
3
- *
4
- * 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
5
- * @supported weapp
6
- * @example
7
- * ```tsx
8
- * Taro.onMemoryWarning(function () {
9
- * console.log('onMemoryWarningReceive')
10
- * })
11
- * ```
12
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.onMemoryWarning.html
13
- */
14
- function onMemoryWarning(
15
- /** 内存不足告警事件的回调函数 */
16
- callback: onMemoryWarning.Callback,
17
- ): void
1
+ import Taro from '../../index'
18
2
 
3
+ declare module '../../index' {
19
4
  namespace onMemoryWarning {
20
5
  /** 内存不足告警事件的回调函数 */
21
6
  type Callback = (
@@ -26,7 +11,7 @@ declare namespace Taro {
26
11
  /** 内存告警等级,只有 Android 才有,对应系统宏定义 */
27
12
  level: keyof level
28
13
  }
29
-
14
+
30
15
  interface level {
31
16
  /** TRIM_MEMORY_RUNNING_MODERATE */
32
17
  5
@@ -36,4 +21,23 @@ declare namespace Taro {
36
21
  15
37
22
  }
38
23
  }
24
+
25
+ interface TaroStatic {
26
+ /** 监听内存不足告警事件。
27
+ *
28
+ * 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
29
+ * @supported weapp
30
+ * @example
31
+ * ```tsx
32
+ * Taro.onMemoryWarning(function () {
33
+ * console.log('onMemoryWarningReceive')
34
+ * })
35
+ * ```
36
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.onMemoryWarning.html
37
+ */
38
+ onMemoryWarning(
39
+ /** 内存不足告警事件的回调函数 */
40
+ callback: onMemoryWarning.Callback,
41
+ ): void
42
+ }
39
43
  }
@@ -1,25 +1,30 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace makePhoneCall {
3
5
  interface Option {
4
6
  /** 需要拨打的电话号码 */
5
7
  phoneNumber: string
6
8
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
- complete?: (res: General.CallbackResult) => void
9
+ complete?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 接口调用失败的回调函数 */
9
- fail?: (res: General.CallbackResult) => void
11
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
12
  /** 接口调用成功的回调函数 */
11
- success?: (res: General.CallbackResult) => void
13
+ success?: (res: TaroGeneral.CallbackResult) => void
12
14
  }
13
15
  }
14
- /** 拨打电话
15
- * @supported weapp, h5, rn
16
- * @example
17
- * ```tsx
18
- * Taro.makePhoneCall({
19
- * phoneNumber: '1340000' //仅为示例,并非真实的电话号码
20
- * })
21
- * ```
22
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/phone/wx.makePhoneCall.html
23
- */
24
- function makePhoneCall(option: makePhoneCall.Option): Promise<General.CallbackResult>
16
+
17
+ interface TaroStatic {
18
+ /** 拨打电话
19
+ * @supported weapp, h5, rn
20
+ * @example
21
+ * ```tsx
22
+ * Taro.makePhoneCall({
23
+ * phoneNumber: '1340000' //仅为示例,并非真实的电话号码
24
+ * })
25
+ * ```
26
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/phone/wx.makePhoneCall.html
27
+ */
28
+ makePhoneCall(option: makePhoneCall.Option): Promise<TaroGeneral.CallbackResult>
29
+ }
25
30
  }
@@ -1,10 +1,12 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace scanCode {
3
5
  interface Option {
4
6
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
5
- complete?: (res: General.CallbackResult) => void
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
6
8
  /** 接口调用失败的回调函数 */
7
- fail?: (res: General.CallbackResult) => void
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 是否只能从相机扫码,不允许从相册选择图片 */
9
11
  onlyFromCamera?: boolean
10
12
  /** 扫码类型 */
@@ -12,7 +14,7 @@ declare namespace Taro {
12
14
  /** 接口调用成功的回调函数 */
13
15
  success?: (result: SuccessCallbackResult) => void
14
16
  }
15
- interface SuccessCallbackResult extends General.CallbackResult {
17
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
16
18
  /** 所扫码的字符集 */
17
19
  charSet: string
18
20
  /** 当所扫的码为当前小程序二维码时,会返回此字段,内容为二维码携带的 path */
@@ -79,26 +81,29 @@ declare namespace Taro {
79
81
  CODE_25
80
82
  }
81
83
  }
82
- /**
83
- * 调起客户端扫码界面,扫码成功后返回对应的结果
84
- * @supported weapp, h5
85
- * @example
86
- * ```tsx
87
- * // 允许从相机和相册扫码
88
- * Taro.scanCode({
89
- * success: (res) => {
90
- * console.log(res)
91
- * }
92
- * })
93
- * // 只允许从相机扫码
94
- * Taro.scanCode({
95
- * onlyFromCamera: true,
96
- * success: (res) => {
97
- * console.log(res)
98
- * }
99
- * })
100
- * ```
101
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/scan/wx.scanCode.html
102
- */
103
- function scanCode(option: scanCode.Option): Promise<scanCode.SuccessCallbackResult>
84
+
85
+ interface TaroStatic {
86
+ /**
87
+ * 调起客户端扫码界面,扫码成功后返回对应的结果
88
+ * @supported weapp, h5
89
+ * @example
90
+ * ```tsx
91
+ * // 允许从相机和相册扫码
92
+ * Taro.scanCode({
93
+ * success: (res) => {
94
+ * console.log(res)
95
+ * }
96
+ * })
97
+ * // 只允许从相机扫码
98
+ * Taro.scanCode({
99
+ * onlyFromCamera: true,
100
+ * success: (res) => {
101
+ * console.log(res)
102
+ * }
103
+ * })
104
+ * ```
105
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/scan/wx.scanCode.html
106
+ */
107
+ scanCode(option: scanCode.Option): Promise<scanCode.SuccessCallbackResult>
108
+ }
104
109
  }