From 468176ae4b9040dce696dfacac4c7031083ca7eb Mon Sep 17 00:00:00 2001 From: "J.C" Date: Thu, 26 Sep 2019 01:55:05 +0800 Subject: [PATCH] fix bug for DownloadTask (#38493) 1, change the parameter as optional for `success` callback of `DownfileParams` interface. 2, fixed bug: the parameter `callback` had a wrong type before for onProgressUpdate interface. --- types/wegame-api/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/wegame-api/index.d.ts b/types/wegame-api/index.d.ts index 82c54c5f3c..a350a962a9 100644 --- a/types/wegame-api/index.d.ts +++ b/types/wegame-api/index.d.ts @@ -288,7 +288,7 @@ declare class DownloadTask { * @param res.totalBytesWritten 已经下载的数据长度,单位 Bytes * @param res.totalBytesExpectedToWrite 预期需要下载的数据总长度,单位 Bytes */ - onProgressUpdate(callback: { res: { progress: number, totalBytesWritten: number, totalBytesExpectedToWrite: number } }): void; + onProgressUpdate(callback: (res: { progress: number, totalBytesWritten: number, totalBytesExpectedToWrite: number }) => void): void; } declare class RequestTask { @@ -1355,7 +1355,7 @@ declare namespace wx { * res.tempFilePath 临时文件路径。如果没传入 filePath 指定文件存储路径,则下载后的文件会存储到一个临时文件 * res.statusCode 开发者服务器返回的 HTTP 状态码 */ - success?: (res: { tempFilePath: string, statusCode: number }) => void; + success?: (res: { tempFilePath?: string, statusCode: number }) => void; fail?: (res: { errMsg: string }) => void; complete?: () => void; }