Skip to content

Commit

Permalink
fix: 修复h5独有属性类型
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Jan 5, 2020
1 parent a946f86 commit 2d3a3a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions packages/taro/types/api/media/image.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,13 @@ declare namespace Taro {
path: string
/** 本地临时文件大小,单位 B */
size: number
/** (仅 H5) 文件的 MIME 类型 */
/** 文件的 MIME 类型
* @supported h5
*/
type?: string
/** (仅 H5) 原始的浏览器 File 对象 */
/** 原始的浏览器 File 对象
* @supported h5
*/
originalFileObj?: File
}
}
Expand Down
16 changes: 8 additions & 8 deletions packages/taro/types/api/network/upload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ declare namespace Taro {
name: string
/** 开发者服务器地址 */
url: string
/** (仅 H5) 上传的文件名 */
fileName: string
/** 上传的文件名
* @supported h5
*/
fileName?: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: (res: General.CallbackResult) => void
/** 接口调用失败的回调函数 */
Expand All @@ -18,12 +20,10 @@ declare namespace Taro {
/** HTTP 请求 Header,Header 中不能设置 Referer */
header?: General.IAnyObject
/** 接口调用成功的回调函数 */
success?: SuccessCallback
success?: (
result: SuccessCallbackResult,
) => void
}
/** 接口调用成功的回调函数 */
type SuccessCallback = (
result: SuccessCallbackResult,
) => void
interface SuccessCallbackResult extends General.CallbackResult {
/** 开发者服务器返回的数据 */
data: string
Expand Down Expand Up @@ -110,7 +110,7 @@ declare namespace Taro {
* ```
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/wx.uploadFile.html
*/
function uploadFile(option: uploadFile.Option): UploadTask
function uploadFile(option: uploadFile.Option): Promise<uploadFile.SuccessCallbackResult & UploadTask> & UploadTask

/** 一个可以监听上传进度变化事件,以及取消上传任务的对象
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.html
Expand Down

0 comments on commit 2d3a3a0

Please sign in to comment.