From 9559c9b0a49a02f1790454579b6861aae239fe4e Mon Sep 17 00:00:00 2001 From: Zhuo Zhang Date: Fri, 5 Jun 2020 12:20:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(types):=20=E4=BF=AE=E5=A4=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit authWithInfo, pay, payInterceptorWithUrl 返回的都是 Promise --- index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index edcbd18..70cf853 100644 --- a/index.d.ts +++ b/index.d.ts @@ -8,19 +8,19 @@ interface IResult { declare namespace Alipay { - function authWithInfo(infoStr: string): IResult; + function authWithInfo(infoStr: string): Promise; // 设置沙箱模式 function setAlipaySandbox(isSandbox: boolean): void - function pay(infoStr: string): IResult; + function pay(infoStr: string): Promise; - function payInterceptorWithUrl(infoStr: string): { + function payInterceptorWithUrl(infoStr: string): Promise<{ resultCode: TStatus; returnUrl: string; - }; + }>; function sign(infoStr: string): string; } -export = Alipay; \ No newline at end of file +export = Alipay; From 4382dea159504405dd5d3b1ff693e9471dcffed7 Mon Sep 17 00:00:00 2001 From: Zhuo Zhang Date: Fri, 5 Jun 2020 12:30:13 +0800 Subject: [PATCH 2/2] feat(types): add exports --- index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.d.ts b/index.d.ts index 70cf853..c412b07 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,22 +1,22 @@ -type TStatus = '9000' | '8000' | '4000' | '5000' | '6001' | '6002'; +export type AlipayResultCode = '9000' | '8000' | '4000' | '5000' | '6001' | '6002'; -interface IResult { - resultStatus: TStatus; +export interface AlipayResult { + resultStatus: AlipayResultCode; result: string; memo: string; } declare namespace Alipay { - function authWithInfo(infoStr: string): Promise; + function authWithInfo(infoStr: string): Promise; // 设置沙箱模式 function setAlipaySandbox(isSandbox: boolean): void - function pay(infoStr: string): Promise; + function pay(infoStr: string): Promise; function payInterceptorWithUrl(infoStr: string): Promise<{ - resultCode: TStatus; + resultCode: AlipayResultCode; returnUrl: string; }>;