@hylid/types 3.3.0-alpha.0 → 3.3.0-alpha.1

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 (2) hide show
  1. package/lib/mp.d.ts +38 -2
  2. package/package.json +1 -1
package/lib/mp.d.ts CHANGED
@@ -7,7 +7,7 @@ export interface AddFatigueActionArgs extends AsyncCallback<any> {
7
7
  }
8
8
  export interface IRPCArgs {
9
9
  operationType: string;
10
- requestData: any[];
10
+ requestData: string | unknown[];
11
11
  headers?: Record<string, any>;
12
12
  gateway?: string;
13
13
  compress?: boolean;
@@ -15,6 +15,13 @@ export interface IRPCArgs {
15
15
  timeout?: number;
16
16
  getResponse?: boolean;
17
17
  }
18
+ export interface getCurrentPagesOptions {
19
+ payload?: Record<string, any>;
20
+ success: (res: {
21
+ route: string;
22
+ }[]) => void;
23
+ fail: (err: any) => void;
24
+ }
18
25
  export interface MPApi extends MiniprogramApi {
19
26
  authorize: (opt: any) => void;
20
27
  getAuthUserInfo: (opt: any) => void;
@@ -33,7 +40,10 @@ export interface MPApi extends MiniprogramApi {
33
40
  isInstalledApp(args?: any): void;
34
41
  navigateToBizScene(args?: any): void;
35
42
  paySignCenter(args?: any): void;
36
- rpc(args: IRPCArgs, callback: (result: any) => void): void;
43
+ rpc(args: IRPCArgs & AsyncCallback<{
44
+ headers: Record<string, string>;
45
+ resData: object;
46
+ }>): void;
37
47
  APRegionRPC(args?: any): void;
38
48
  startApp(args?: any): void;
39
49
  startBizService(args?: any): void;
@@ -53,7 +63,33 @@ export interface MPApi extends MiniprogramApi {
53
63
  canIUse(args: string): boolean;
54
64
  SDKVersion: any;
55
65
  hideOptionButton(args?: any): void;
66
+ getCurrentLanguage(): string;
67
+ openURL(args?: Common): Promise<void>;
68
+ getAppId(args: AsyncCallback<{
69
+ appId: string;
70
+ }>): void;
71
+ getCurrentPages(args: getCurrentPagesOptions): void;
72
+ getSDKVersion(args: AsyncCallback<string>): void;
73
+ createWithoutAuthRpc: (args: {
74
+ appId?: string;
75
+ workspaceId?: string;
76
+ defaultGateway: string;
77
+ defaultHeaders?: Record<string, string>;
78
+ request: (args: RequestArgs) => void;
79
+ }) => PickMPAttr<'rpc'>;
80
+ rpcWithAuth: PickMPAttr<'rpc'>;
81
+ rpcWithAuthAPlus: PickMPAttr<'rpc'>;
82
+ defineRuntimeConfig: {
83
+ (args: Record<string, any>): void;
84
+ getRuntimeConfig?: () => Record<string, any>;
85
+ };
86
+ getAuthCode: (args: {
87
+ scopes: string | string[];
88
+ appId?: string;
89
+ } & AsyncCallback<GetAuthCodeCallbackValue>) => void;
56
90
  }
57
91
  export declare type PickMPAttr<Attr extends keyof MPApi> = PickAttr<Attr, MPApi>;
58
92
  export declare type PickMPArgs<Attr extends keyof MPApi> = Parameters<PickMPAttr<Attr>>[0];
59
93
  export declare type PickMpReturns<Attr extends keyof MPApi> = ReturnType<PickMPAttr<Attr>>;
94
+ export declare type ReturnTypePromise<T> = T extends AsyncCallback<infer S> ? (args?: Omit<T, "success" | "fail" | "complete"> | undefined) => Promise<S> : never;
95
+ export declare type PickPromiseAttr<T> = T extends (args: infer S) => void ? ReturnTypePromise<S> : never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hylid/types",
3
- "version": "3.3.0-alpha.0",
3
+ "version": "3.3.0-alpha.1",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "lib",