@tarojs/taro 3.4.1 → 3.4.2

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 (88) hide show
  1. package/package.json +5 -5
  2. package/types/api/ai/face.d.ts +133 -0
  3. package/types/api/ai/visionkit.d.ts +303 -0
  4. package/types/api/base/crypto.d.ts +90 -0
  5. package/types/api/base/debug.d.ts +152 -13
  6. package/types/api/base/env.d.ts +2 -1
  7. package/types/api/base/index.d.ts +10 -2
  8. package/types/api/base/performance.d.ts +195 -0
  9. package/types/api/base/system.d.ts +539 -101
  10. package/types/api/base/update.d.ts +59 -7
  11. package/types/api/base/weapp/app-event.d.ts +46 -23
  12. package/types/api/base/weapp/life-cycle.d.ts +141 -1
  13. package/types/api/canvas/index.d.ts +150 -136
  14. package/types/api/cloud/index.d.ts +2 -2
  15. package/types/api/device/accelerometer.d.ts +3 -3
  16. package/types/api/device/accessibility.d.ts +26 -0
  17. package/types/api/device/battery.d.ts +2 -2
  18. package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
  19. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  20. package/types/api/device/bluetooth.d.ts +67 -2
  21. package/types/api/device/calendar.d.ts +88 -0
  22. package/types/api/device/contact.d.ts +74 -50
  23. package/types/api/device/gyroscope.d.ts +5 -5
  24. package/types/api/device/iBeacon.d.ts +33 -19
  25. package/types/api/{ui → device}/keyboard.d.ts +0 -0
  26. package/types/api/device/{performance.d.ts → memory.d.ts} +4 -4
  27. package/types/api/device/motion.d.ts +3 -3
  28. package/types/api/device/network.d.ts +53 -12
  29. package/types/api/device/nfc.d.ts +1089 -13
  30. package/types/api/device/scan.d.ts +1 -1
  31. package/types/api/device/screen.d.ts +40 -12
  32. package/types/api/device/wifi.d.ts +41 -6
  33. package/types/api/files/index.d.ts +371 -184
  34. package/types/api/location/index.d.ts +116 -55
  35. package/types/api/media/audio.d.ts +629 -38
  36. package/types/api/media/background-audio.d.ts +8 -8
  37. package/types/api/media/camera.d.ts +38 -19
  38. package/types/api/media/editor.d.ts +22 -2
  39. package/types/api/media/image.d.ts +61 -32
  40. package/types/api/media/live.d.ts +66 -6
  41. package/types/api/media/map.d.ts +469 -49
  42. package/types/api/media/media-recorder.d.ts +92 -0
  43. package/types/api/media/recorder.d.ts +20 -20
  44. package/types/api/media/video-decoder.d.ts +117 -0
  45. package/types/api/media/video-processing.d.ts +11 -7
  46. package/types/api/media/video.d.ts +45 -16
  47. package/types/api/media/voip.d.ts +290 -0
  48. package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -25
  49. package/types/api/network/download.d.ts +39 -16
  50. package/types/api/network/request.d.ts +125 -37
  51. package/types/api/network/tcp.d.ts +181 -0
  52. package/types/api/network/udp.d.ts +154 -83
  53. package/types/api/network/upload.d.ts +41 -25
  54. package/types/api/network/websocket.d.ts +16 -15
  55. package/types/api/open-api/authorize.d.ts +41 -2
  56. package/types/api/open-api/channels.d.ts +178 -0
  57. package/types/api/open-api/facial.d.ts +3 -0
  58. package/types/api/open-api/favorites.d.ts +100 -0
  59. package/types/api/open-api/group.d.ts +59 -0
  60. package/types/api/open-api/invoice.d.ts +2 -2
  61. package/types/api/open-api/license-plate.d.ts +27 -0
  62. package/types/api/open-api/login.d.ts +21 -0
  63. package/types/api/open-api/redpackage.d.ts +24 -0
  64. package/types/api/open-api/settings.d.ts +76 -14
  65. package/types/api/open-api/soter.d.ts +2 -2
  66. package/types/api/open-api/subscribe-message.d.ts +88 -3
  67. package/types/api/open-api/user-info.d.ts +55 -18
  68. package/types/api/open-api/werun.d.ts +33 -6
  69. package/types/api/payment/index.d.ts +119 -0
  70. package/types/api/route/index.d.ts +13 -9
  71. package/types/api/share/index.d.ts +192 -9
  72. package/types/api/storage/index.d.ts +29 -83
  73. package/types/api/swan/index.d.ts +1 -1
  74. package/types/api/ui/animation.d.ts +84 -70
  75. package/types/api/ui/background.d.ts +4 -2
  76. package/types/api/ui/custom-component.d.ts +1 -1
  77. package/types/api/ui/fonts.d.ts +27 -31
  78. package/types/api/ui/navigation-bar.d.ts +1 -0
  79. package/types/api/ui/scroll.d.ts +73 -7
  80. package/types/api/ui/sticky.d.ts +4 -4
  81. package/types/api/ui/tab-bar.d.ts +7 -7
  82. package/types/api/ui/window.d.ts +22 -2
  83. package/types/api/worker/index.d.ts +9 -1
  84. package/types/api/wxml/index.d.ts +111 -107
  85. package/types/compile.d.ts +5 -0
  86. package/types/global.d.ts +142 -111
  87. package/types/taro.api.d.ts +79 -62
  88. package/types/api/open-api/payment.d.ts +0 -61
@@ -5,65 +5,115 @@ declare module '../../index' {
5
5
  interface Option < U extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any > {
6
6
  /** 开发者服务器接口地址 */
7
7
  url: string
8
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
9
- complete?: (res: TaroGeneral.CallbackResult) => void
10
8
  /** 请求的参数 */
11
9
  data?: U
12
- /** 返回的数据格式 */
13
- dataType?: keyof dataType | string
14
- /** 接口调用失败的回调函数 */
15
- fail?: (res: TaroGeneral.CallbackResult) => void
16
10
  /** 设置请求的 header,header 中不能设置 Referer。
17
11
  *
18
- * `content-type` 默认为 `application/json` */
12
+ * `content-type` 默认为 `application/json`
13
+ */
19
14
  header?: TaroGeneral.IAnyObject
20
- /** HTTP 请求方法 */
21
- method?: keyof method
15
+ /** 超时时间,单位为毫秒
16
+ * @default 2000
17
+ * @supported weapp, h5
18
+ */
19
+ timeout?: number
20
+ /** HTTP 请求方法
21
+ * @default GET
22
+ */
23
+ method?: keyof Method
24
+ /** 返回的数据格式 */
25
+ dataType?: keyof DataType | string
22
26
  /** 响应的数据类型 */
23
- responseType?: keyof responseType
27
+ responseType?: keyof ResponseType
28
+ /** 开启 http2
29
+ * @default false
30
+ * @supported weapp
31
+ */
32
+ enableHttp2?: boolean
33
+ /** 开启 quic
34
+ * @default false
35
+ * @supported weapp
36
+ */
37
+ enableQuic?: boolean
38
+ /** 开启 cache
39
+ * @default false
40
+ * @supported weapp
41
+ */
42
+ enableCache?: boolean
43
+ /** 是否开启 HttpDNS 服务。如开启,需要同时填入 httpDNSServiceId 。 HttpDNS 用法详见 移动解析HttpDNS
44
+ * @default false
45
+ * @supported weapp
46
+ */
47
+ enableHttpDNS?: boolean
48
+ /** HttpDNS 服务商 Id。 HttpDNS 用法详见 移动解析HttpDNS
49
+ * @supported weapp
50
+ */
51
+ httpDNSServiceId?: string
52
+ /** 开启 transfer-encoding chunked。
53
+ * @default false
54
+ * @supported weapp
55
+ */
56
+ enableChunked?: boolean
24
57
  /** 接口调用成功的回调函数 */
25
58
  success?: (result: SuccessCallbackResult) => void
59
+ /** 接口调用失败的回调函数 */
60
+ fail?: (res: TaroGeneral.CallbackResult) => void
61
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
62
+ complete?: (res: TaroGeneral.CallbackResult) => void
26
63
  /** 设置 H5 端是否使用jsonp方式获取数据
27
64
  * @default false
65
+ * @supported h5
28
66
  */
29
67
  jsonp?: boolean
30
68
  /** 设置 H5 端 jsonp 请求 url 是否需要被缓存
31
69
  * @default false
70
+ * @supported h5
32
71
  */
33
72
  jsonpCache?: boolean
34
73
  /** 设置 H5 端是否允许跨域请求
35
74
  * @default same-origin
75
+ * @supported h5
36
76
  */
37
- mode?: keyof cors_mode
77
+ mode?: keyof CorsMode
38
78
  /** 设置 H5 端是否携带 Cookie
39
79
  * @default omit
80
+ * @supported h5
40
81
  */
41
- credentials?: keyof credentials
82
+ credentials?: keyof Credentials
42
83
  /** 设置 H5 端缓存模式
43
84
  * @default default
85
+ * @supported h5
44
86
  */
45
- cache?: keyof cache
46
- /** 设置 H5 端请求响应超时时间
47
- * @default 2000
48
- */
49
- timeout?: number
87
+ cache?: keyof Cache
50
88
  /** 设置 H5 端请求重试次数
51
89
  * @default 2
90
+ * @supported h5
52
91
  */
53
92
  retryTimes?: number
54
- /** 设置 H5 端请求的兜底接口 */
93
+ /** 设置 H5 端请求的兜底接口
94
+ * @supported h5
95
+ */
55
96
  backup?: string | string[]
56
- /** 设置 H5 端请求响应的数据校验函数,若返回 false,则请求兜底接口,若无兜底接口,则报请求失败 */
97
+ /** 设置 H5 端请求响应的数据校验函数,若返回 false,则请求兜底接口,若无兜底接口,则报请求失败
98
+ * @supported h5
99
+ */
57
100
  dataCheck?(): boolean
58
101
  /** 设置 H5 端请求是否使用缓存
59
102
  * @default false
103
+ * @supported h5
60
104
  */
61
105
  useStore?: boolean
62
- /** 设置 H5 端请求缓存校验的 key */
106
+ /** 设置 H5 端请求缓存校验的 key
107
+ * @supported h5
108
+ */
63
109
  storeCheckKey?: string
64
- /** 设置 H5 端请求缓存签名 */
110
+ /** 设置 H5 端请求缓存签名
111
+ * @supported h5
112
+ */
65
113
  storeSign?: string
66
- /** 设置 H5 端请求校验函数,一般不需要设置 */
114
+ /** 设置 H5 端请求校验函数,一般不需要设置
115
+ * @supported h5
116
+ */
67
117
  storeCheck?(): boolean
68
118
  }
69
119
 
@@ -81,7 +131,7 @@ declare module '../../index' {
81
131
  }
82
132
 
83
133
  /** 返回的数据格式 */
84
- interface dataType {
134
+ interface DataType {
85
135
  /** 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse
86
136
  * 其他: 不对返回的内容进行 JSON.parse
87
137
  */
@@ -89,7 +139,7 @@ declare module '../../index' {
89
139
  }
90
140
 
91
141
  /** HTTP 请求方法 */
92
- interface method {
142
+ interface Method {
93
143
  /** HTTP 请求 OPTIONS */
94
144
  OPTIONS
95
145
  /** HTTP 请求 GET */
@@ -109,7 +159,7 @@ declare module '../../index' {
109
159
  }
110
160
 
111
161
  /** 响应的数据类型 */
112
- interface responseType {
162
+ interface ResponseType {
113
163
  /** 响应的数据为文本 */
114
164
  text
115
165
  /** 响应的数据为 ArrayBuffer */
@@ -117,7 +167,7 @@ declare module '../../index' {
117
167
  }
118
168
 
119
169
  /** 跨域策略 */
120
- interface cors_mode {
170
+ interface CorsMode {
121
171
  /** 跨域请求将获取不透明的响应 */
122
172
  'no-cors'
123
173
  /** 允许跨域请求 */
@@ -126,7 +176,7 @@ declare module '../../index' {
126
176
  'same-origin'
127
177
  }
128
178
  /** 证书 */
129
- interface credentials {
179
+ interface Credentials {
130
180
  /** 不论是不是跨域的请求,总是发送请求资源域在本地的 cookies、 HTTP Basic authentication 等验证信息 */
131
181
  include
132
182
  /** 只有当URL与响应脚本同源才发送 cookies、 HTTP Basic authentication 等验证信息 */
@@ -135,7 +185,7 @@ declare module '../../index' {
135
185
  omit
136
186
  }
137
187
  /** 缓存策略 */
138
- interface cache {
188
+ interface Cache {
139
189
  /** 浏览器从HTTP缓存中寻找匹配的请求 */
140
190
  default
141
191
  /** 浏览器在其HTTP缓存中寻找匹配的请求 */
@@ -150,6 +200,7 @@ declare module '../../index' {
150
200
  }
151
201
 
152
202
  /** 网络请求任务对象
203
+ * @supported weapp, h5, rn, alipay, swan, tt, qq
153
204
  * @example
154
205
  * 回调函数(Callback)用法:
155
206
  *
@@ -199,6 +250,7 @@ declare module '../../index' {
199
250
  * const res = await requestTask
200
251
  * requestTask.abort()
201
252
  * ```
253
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.html
202
254
  */
203
255
  interface RequestTask<T> extends Promise<request.SuccessCallbackResult<T>> {
204
256
  /** 中断请求任务
@@ -206,33 +258,68 @@ declare module '../../index' {
206
258
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.abort.html
207
259
  */
208
260
  abort(): void
261
+ /** 监听 HTTP Response Header 事件。会比请求完成事件更早
262
+ * @supported weapp
263
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html
264
+ */
265
+ onHeadersReceived(
266
+ /** HTTP Response Header 事件的回调函数 */
267
+ callback: RequestTask.onHeadersReceived.Callback,
268
+ ): void
209
269
  /** 取消监听 HTTP Response Header 事件
210
270
  * @supported weapp
211
271
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offHeadersReceived.html
212
272
  */
213
273
  offHeadersReceived(
214
274
  /** HTTP Response Header 事件的回调函数 */
215
- callback: (res: TaroGeneral.CallbackResult) => void,
275
+ callback: RequestTask.onHeadersReceived.Callback,
216
276
  ): void
217
- /** 监听 HTTP Response Header 事件。会比请求完成事件更早
277
+ /** 监听 Transfer-Encoding Chunk Received 事件。当接收到新的chunk时触发。
218
278
  * @supported weapp
219
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html
279
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onChunkReceived.html
220
280
  */
221
- onHeadersReceived(
222
- /** HTTP Response Header 事件的回调函数 */
223
- callback: (result: RequestTask.OnHeadersReceivedCallbackResult) => void,
281
+ onChunkReceived(
282
+ /** Transfer-Encoding Chunk Received 事件的回调函数 */
283
+ callback: RequestTask.onChunkReceived.Callback,
284
+ ): void
285
+ /** 监听 Transfer-Encoding Chunk Received 事件。当接收到新的chunk时触发。
286
+ * @supported weapp
287
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offChunkReceived.html
288
+ */
289
+ offChunkReceived(
290
+ /** Transfer-Encoding Chunk Received 事件的回调函数 */
291
+ callback: RequestTask.onChunkReceived.Callback,
224
292
  ): void
225
293
  }
226
294
 
227
295
  namespace RequestTask {
228
- interface OnHeadersReceivedCallbackResult {
229
- /** 开发者服务器返回的 HTTP Response Header */
230
- header: TaroGeneral.IAnyObject
296
+ namespace onHeadersReceived {
297
+ /** HTTP Response Header 事件的回调函数 */
298
+ type Callback = (result: CallbackResult) => void
299
+ interface CallbackResult {
300
+ /** 开发者服务器返回的 HTTP Response Header */
301
+ header: TaroGeneral.IAnyObject
302
+ }
303
+ }
304
+ namespace onChunkReceived {
305
+ /** Transfer-Encoding Chunk Received 事件的回调函数 */
306
+ type Callback = (result: CallbackResult) => void
307
+ interface CallbackResult {
308
+ /** 开发者服务器每次返回新 chunk 时的 Response */
309
+ res: Response
310
+ }
311
+ /** 开发者服务器每次返回新 chunk 时的 Response */
312
+ interface Response {
313
+ /** 返回的chunk buffer */
314
+ data: ArrayBuffer
315
+ }
231
316
  }
232
317
  }
233
318
 
319
+ /** @ignore */
234
320
  type interceptor = (chain: Chain) => any
235
321
 
322
+ /** @ignore */
236
323
  interface Chain {
237
324
  index: number
238
325
  requestParams: RequestParams
@@ -240,6 +327,7 @@ declare module '../../index' {
240
327
  proceed(requestParams: RequestParams): any
241
328
  }
242
329
 
330
+ /** @ignore */
243
331
  interface interceptors {
244
332
  logInterceptor(chain: Chain): Promise<any>
245
333
 
@@ -0,0 +1,181 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ /** 一个 TCP Socket 实例,默认使用 IPv4 协议
5
+ * @supported weapp
6
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.html
7
+ */
8
+ interface TCPSocket {
9
+ /** 在给定的套接字上启动连接
10
+ * @supported weapp
11
+ * @example
12
+ * ```tsx
13
+ * const tcp = Taro.createTCPSocket()
14
+ * tcp.connect({ address: '192.168.193.2', port: 8848 })
15
+ * ```
16
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.connect.html
17
+ */
18
+ connect(option: TCPSocket.connect.Option): void
19
+ /** 在 socket 上发送数据
20
+ * @supported weapp
21
+ * @example
22
+ * ```tsx
23
+ * const tcp = Taro.createTCPSocket()
24
+ * tcp.write('hello, how are you')
25
+ * ```
26
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.write.html
27
+ */
28
+ write(
29
+ /** 要发送的数据 */
30
+ data: string | ArrayBuffer
31
+ ): void
32
+ /** 关闭连接
33
+ * @supported weapp
34
+ * @example
35
+ * ```tsx
36
+ * const tcp = Taro.createTCPSocket()
37
+ * tcp.close()
38
+ * ```
39
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.close.html
40
+ */
41
+ close(): void
42
+ /** 监听关闭事件
43
+ * @supported weapp
44
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onClose.html
45
+ */
46
+ onClose(
47
+ /** 当一个 socket 完全关闭就发出该事件的回调函数 */
48
+ callback: TCPSocket.onClose.Callback,
49
+ ): void
50
+ /** 取消监听当一个 socket 完全关闭就发出该事件
51
+ * @supported weapp
52
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offClose.html
53
+ */
54
+ offClose(
55
+ /** 当一个 socket 完全关闭就发出该事件的回调函数 */
56
+ callback: TCPSocket.onClose.Callback,
57
+ ): void
58
+ /** 监听当一个 socket 连接成功建立的时候触发该事件
59
+ * @supported weapp
60
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onConnect.html
61
+ */
62
+ onConnect(
63
+ /** 当一个 socket 连接成功建立的时候触发该事件的回调函数 */
64
+ callback: TCPSocket.onConnect.Callback,
65
+ ): void
66
+ /** 取消监听当一个 socket 连接成功建立的时候触发该事件
67
+ * @supported weapp
68
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offConnect.html
69
+ */
70
+ offConnect(
71
+ /** 当一个 socket 连接成功建立的时候触发该事件的回调函数 */
72
+ callback: TCPSocket.onConnect.Callback,
73
+ ): void
74
+ /** 监听当错误发生时触发
75
+ * @supported weapp
76
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onError.html
77
+ */
78
+ onError(
79
+ /** 监听当错误发生时触发的回调函数 */
80
+ callback: TCPSocket.onError.Callback,
81
+ ): void
82
+ /** 取消监听当错误发生时触发
83
+ * @supported weapp
84
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offError.html
85
+ */
86
+ offError(
87
+ /** 监听当错误发生时触发的回调函数 */
88
+ callback: TCPSocket.onError.Callback,
89
+ ): void
90
+ /** 监听当接收到数据的时触发该事件
91
+ * @supported weapp
92
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onMessage.html
93
+ */
94
+ onMessage(
95
+ /** 当接收到数据的时触发该事件的回调函数 */
96
+ callback: TCPSocket.onMessage.Callback,
97
+ ): void
98
+ /** 取消监听当接收到数据的时触发该事件
99
+ * @supported weapp
100
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offMessage.html
101
+ */
102
+ offMessage(
103
+ /** 当接收到数据的时触发该事件的回调函数 */
104
+ callback: TCPSocket.onMessage.Callback,
105
+ ): void
106
+ }
107
+
108
+ namespace TCPSocket {
109
+ namespace connect {
110
+ interface Option {
111
+ /** 套接字要连接的地址 */
112
+ address: string
113
+ /** 套接字要连接的端口 */
114
+ port: number
115
+ }
116
+ }
117
+ namespace onClose {
118
+ /** 当一个 socket 完全关闭就发出该事件的回调函数 */
119
+ type Callback = (...args: unknown[]) => void
120
+ }
121
+ namespace onConnect {
122
+ /** 当一个 socket 连接成功建立的时候触发该事件的回调函数 */
123
+ type Callback = (...args: unknown[]) => void
124
+ }
125
+ namespace onError {
126
+ /** 监听当错误发生时触发的回调函数 */
127
+ type Callback = (result: CallbackResult) => void
128
+ interface CallbackResult extends TaroGeneral.CallbackResult {
129
+ /** 错误信息 */
130
+ errMsg: string
131
+ }
132
+ }
133
+ namespace onMessage {
134
+ /** 当接收到数据的时触发该事件的回调函数 */
135
+ type Callback = (result: CallbackResult) => void
136
+ interface CallbackResult extends TaroGeneral.CallbackResult {
137
+ /** 收到的消息 */
138
+ message: ArrayBuffer
139
+ /** 发送端地址信息 */
140
+ remoteInfo: RemoteInfo
141
+ /** 接收端地址信息 */
142
+ localInfo: LocalInfo
143
+ }
144
+ /** 发送端地址信息 */
145
+ interface RemoteInfo {
146
+ /** 发送消息的 socket 的地址 */
147
+ address: string
148
+ /** 使用的协议族,为 IPv4 或者 IPv6 */
149
+ family: string
150
+ /** 端口号 */
151
+ port: number
152
+ /** message 的大小,单位:字节 */
153
+ size: number
154
+ }
155
+ /** 接收端地址信息 */
156
+ interface LocalInfo {
157
+ /** 接收消息的 socket 的地址 */
158
+ address: string
159
+ /** 使用的协议族,为 IPv4 或者 IPv6 */
160
+ family: string
161
+ /** 端口号 */
162
+ port: number
163
+ }
164
+ }
165
+ }
166
+
167
+ interface TaroStatic {
168
+ /** 创建一个 TCP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
169
+ *
170
+ * **连接限制**
171
+ *
172
+ * - 允许与局域网内的非本机 IP 通信
173
+ * - 允许与配置过的服务器域名通信,详见[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)
174
+ * - 禁止与以下端口号连接:1024 以下 1099 1433 1521 1719 1720 1723 2049 2375 3128 3306 3389 3659 4045 5060 5061 5432 5984 6379 6000 6566 7001 7002 8000-8100 8443 8888 9200 9300 10051 10080 11211 27017 27018 27019
175
+ * - 每 5 分钟内最多创建 20 个 TCPSocket
176
+ * @supported weapp
177
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/wx.createTCPSocket.html
178
+ */
179
+ createTCPSocket(): TCPSocket
180
+ }
181
+ }