From fc250c54ed0c7d0a02cc28952671a85ec445490c Mon Sep 17 00:00:00 2001 From: Jasery Date: Wed, 5 Nov 2025 14:21:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=BC=95=E7=94=A8=E6=A0=BC=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E7=89=88=E6=9C=AC=E5=8F=B7=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/main.ts | 23 ----------------------- src/renderer/types/global.d.ts | 7 +++++++ tsconfig.json | 6 ++++-- tsconfig.node.json | 1 - 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/renderer/main.ts b/src/renderer/main.ts index 5001e0e..cf28fa5 100644 --- a/src/renderer/main.ts +++ b/src/renderer/main.ts @@ -6,29 +6,6 @@ import vuetify from '@/renderer/plugins/vuetify' import i18n from '@/renderer/plugins/i18n' import pinia from '@/renderer/plugins/pinia' -// Add API key defined in contextBridge to window object type -declare global { - interface Window { - mainApi?: any - ConfirmDialogManager?: { - showConfirm: (options: { - title: string; - message: string; - confirmText?: string; - cancelText?: string; - confirmColor?: string; - }) => Promise; - showMessage: (options: { - title: string; - message: string; - confirmText?: string; - confirmColor?: string; - dialogColor?: string; - }) => Promise; - }; - } -} - const app = createApp(App) app.use(vuetify).use(i18n).use(router).use(pinia) diff --git a/src/renderer/types/global.d.ts b/src/renderer/types/global.d.ts index a7a2870..582cfc7 100644 --- a/src/renderer/types/global.d.ts +++ b/src/renderer/types/global.d.ts @@ -16,4 +16,11 @@ interface Window { dialogColor?: string; }) => Promise; }; + mainApi: { + send: (channel: string, ...data: any[]) => void; + on: (channel: string, listener: (event: any, ...args: any[]) => void) => void; + once: (channel: string, listener: (event: any, ...args: any[]) => void) => void; + off: (channel: string, listener: (event: any, ...args: any[]) => void) => void; + invoke: (channel: string, ...data: any[]) => Promise; + }; } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index ff005a8..30896b7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,8 @@ "jsx": "preserve", "noImplicitAny": false, "allowSyntheticDefaultImports": true, - "declaration": true, + "declaration": false, + "declarationMap": false, "resolveJsonModule": true, "esModuleInterop": true, "sourceMap": true, @@ -19,7 +20,8 @@ }, "lib": ["esnext", "dom"] }, - "include": ["src/*.ts", "src/*.d.ts", "src/renderer", "src/types"], + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/renderer", "src/types"], + "exclude": ["src/main", "src/preload"], "references": [ { "path": "./tsconfig.node.json" diff --git a/tsconfig.node.json b/tsconfig.node.json index b813579..e519ecd 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -12,7 +12,6 @@ "include": [ "src/main", "src/preload", - "src/types", "package.json", "eslint.config.ts", "vite.config.mts",