diff --git a/app/extend-electron.d.ts b/app/extend-electron.d.ts new file mode 100644 index 00000000..081da5e6 --- /dev/null +++ b/app/extend-electron.d.ts @@ -0,0 +1,22 @@ +import type {Server} from './rpc'; + +declare module 'electron' { + interface App { + config: typeof import('./config'); + plugins: typeof import('./plugins'); + getWindows: () => Set; + getLastFocusedWindow: () => BrowserWindow | null; + windowCallback: (win: BrowserWindow) => void; + createWindow: (fn?: (win: BrowserWindow) => void, options?: Record) => BrowserWindow; + setVersion: (version: string) => void; + } + + // type Server = import('./rpc').Server; + interface BrowserWindow { + uid: string; + sessions: Map; + focusTime: number; + clean: () => void; + rpc: Server; + } +} diff --git a/app/index.ts b/app/index.ts index 81a91c02..c629689a 100644 --- a/app/index.ts +++ b/app/index.ts @@ -47,28 +47,6 @@ import {gitDescribe} from 'git-describe'; import isDev from 'electron-is-dev'; import * as config from './config'; -// Hack - this declararion doesn't work when put into ./ext-modules.d.ts for some reason so it's in this file for the time being -declare module 'electron' { - interface App { - config: typeof import('./config'); - plugins: typeof import('./plugins'); - getWindows: () => Set; - getLastFocusedWindow: () => BrowserWindow | null; - windowCallback: (win: BrowserWindow) => void; - createWindow: (fn?: (win: BrowserWindow) => void, options?: Record) => BrowserWindow; - setVersion: (version: string) => void; - } - - type Server = import('./rpc').Server; - interface BrowserWindow { - uid: string; - sessions: Map; - focusTime: number; - clean: () => void; - rpc: Server; - } -} - // set up config config.setup();