chore(types): re-add type-only BrowserWindow / Tray imports
Follow-up to the CJS refactor: destructuring electron.BrowserWindow /
electron.Tray pulled the values into scope but lost the type
namespace, breaking sites that used the bare class name as a type
(let win: BrowserWindow | null, return-type annotations,
implicitly-any close handlers). Added 'import type { ... as ...Type }'
for each affected file and replaced the type-position references
with the aliased names. Runtime semantics unchanged; typecheck
exits 0 again.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import electron from 'electron';
|
||||
import type { Tray as TrayType } from 'electron';
|
||||
const { app, Tray, Menu, nativeImage } = electron;
|
||||
|
||||
let tray: Tray | null = null;
|
||||
let tray: TrayType | null = null;
|
||||
|
||||
export function createTray(showInbox: () => void, showCapture: () => void): Tray {
|
||||
export function createTray(showInbox: () => void, showCapture: () => void): TrayType {
|
||||
const icon = nativeImage.createEmpty();
|
||||
tray = new Tray(icon);
|
||||
tray.setToolTip('Inkling');
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import electron from 'electron';
|
||||
import type { BrowserWindow as BrowserWindowType } from 'electron';
|
||||
const { BrowserWindow, app } = electron;
|
||||
import { join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
let inboxWindow: BrowserWindow | null = null;
|
||||
let inboxWindow: BrowserWindowType | null = null;
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||
|
||||
export function getInboxWindow(): BrowserWindow | null {
|
||||
export function getInboxWindow(): BrowserWindowType | null {
|
||||
return inboxWindow;
|
||||
}
|
||||
|
||||
export function createInboxWindow(): BrowserWindow {
|
||||
export function createInboxWindow(): BrowserWindowType {
|
||||
if (inboxWindow && !inboxWindow.isDestroyed()) {
|
||||
inboxWindow.show();
|
||||
inboxWindow.focus();
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import electron from 'electron';
|
||||
import type { BrowserWindow as BrowserWindowType } from 'electron';
|
||||
const { BrowserWindow, screen } = electron;
|
||||
import { join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
let win: BrowserWindow | null = null;
|
||||
let win: BrowserWindowType | null = null;
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||
|
||||
export function getQuickCaptureWindow(): BrowserWindow | null { return win; }
|
||||
export function getQuickCaptureWindow(): BrowserWindowType | null { return win; }
|
||||
|
||||
export function createQuickCaptureWindow(): BrowserWindow {
|
||||
export function createQuickCaptureWindow(): BrowserWindowType {
|
||||
if (win && !win.isDestroyed()) return win;
|
||||
const primary = screen.getPrimaryDisplay();
|
||||
const W = 640, H = 280;
|
||||
|
||||
Reference in New Issue
Block a user