feat(web): add ElectronAPI type declaration for window.electronAPI

This commit is contained in:
CREDO23 2026-03-20 20:39:18 +02:00
parent 9e058e1329
commit d6d4ebc75d
2 changed files with 15 additions and 1 deletions

View file

@ -317,7 +317,7 @@ const Composer: FC = () => {
// Clipboard content
const [clipboardText, setClipboardText] = useState<string | undefined>();
useEffect(() => {
const api = (window as { electronAPI?: { getClipboardContent?: () => Promise<string> } }).electronAPI;
const api = window.electronAPI;
if (!api?.getClipboardContent) return;
api.getClipboardContent().then((text) => {
if (text) setClipboardText(text);

View file

@ -1,7 +1,21 @@
import type { PostHog } from "posthog-js";
interface ElectronAPI {
versions: {
electron: string;
node: string;
chrome: string;
platform: string;
};
openExternal: (url: string) => void;
getAppVersion: () => Promise<string>;
getClipboardContent: () => Promise<string>;
onDeepLink: (callback: (url: string) => void) => () => void;
}
declare global {
interface Window {
posthog?: PostHog;
electronAPI?: ElectronAPI;
}
}