hookehuyr

✨ feat: TS配置全局类型和配置APPID环境变量

...@@ -12,3 +12,6 @@ VITE_OUTDIR = voice ...@@ -12,3 +12,6 @@ VITE_OUTDIR = voice
12 12
13 # 是否开启调试 13 # 是否开启调试
14 VITE_CONSOLE = 0 14 VITE_CONSOLE = 0
15 +
16 +# appID相关
17 +VITE_APPID=微信appID
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
7 * @Description: 7 * @Description:
8 */ 8 */
9 interface ImportMetaEnv extends Readonly<Record<string, string>> { 9 interface ImportMetaEnv extends Readonly<Record<string, string>> {
10 - readonly VITE_OPENID: string 10 + readonly VITE_OPENID: string;
11 - readonly VITE_ID: string 11 + readonly VITE_ID: string;
12 - readonly VITE_PIN: string 12 + readonly VITE_PIN: string;
13 + readonly VITE_APPID: string;
13 } 14 }
14 15
15 interface ImportMeta { 16 interface ImportMeta {
......
...@@ -35,11 +35,12 @@ ...@@ -35,11 +35,12 @@
35 ] 35 ]
36 }, 36 },
37 "include": [ 37 "include": [
38 + "**/*.d.ts",
38 "src/**/*.ts", 39 "src/**/*.ts",
39 "src/**/*.tsx", 40 "src/**/*.tsx",
40 "src/**/*.vue", 41 "src/**/*.vue",
41 "tests/**/*.ts", 42 "tests/**/*.ts",
42 - "tests/**/*.tsx", "src/views/test/test.js", 43 + "tests/**/*.tsx",
43 ], 44 ],
44 "exclude": [ 45 "exclude": [
45 "node_modules", 46 "node_modules",
......
1 +/*
2 + * @Date: 2022-06-13 10:39:44
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2022-06-13 10:41:43
5 + * @FilePath: /tswj/typings/index.d.ts
6 + * @Description: 文件描述
7 + */
8 +export {};
9 +
10 +// => 全局类型声明
11 +declare global {
12 + interface Window {
13 + _hmt: any;
14 + wx: any;
15 + AlipayJSBridge: any;
16 + }
17 + namespace GD {
18 + interface BaseResponse<T = any> {
19 + code: number;
20 + data: T;
21 + msg: string;
22 + page: {
23 + pageNo: number;
24 + pageSize: number;
25 + pages: number;
26 + total: number;
27 + };
28 + }
29 + }
30 +}
31 +
32 +// const response = GD.BaseResponse<{name: string}>