From ca828d45a680212516772c3f973613f09477ec00 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Wed, 30 Jul 2025 10:05:28 +0000 Subject: [PATCH] cleanup: Remove unused duplicate type definition files - Remove src/types/global.d.ts and src/types/modules.d.ts (unused duplicates) - Keep essential type files: sql.js.d.ts and absurd-sql.d.ts - Maintain all existing type definitions and functionality The removed files contained broken import paths and duplicate type declarations that were never actually used by the codebase. All necessary type support for @jlongster/sql.js and absurd-sql modules is preserved in the remaining files. Files removed: - src/types/global.d.ts (unused, had broken imports) - src/types/modules.d.ts (unused, had broken imports) Files kept: - src/types/sql.js.d.ts (comprehensive @jlongster/sql.js types) - src/types/absurd-sql.d.ts (comprehensive absurd-sql types) - src/interfaces/database.ts (core database types) --- src/types/global.d.ts | 83 ------------------------------------------ src/types/modules.d.ts | 67 ---------------------------------- 2 files changed, 150 deletions(-) delete mode 100644 src/types/global.d.ts delete mode 100644 src/types/modules.d.ts diff --git a/src/types/global.d.ts b/src/types/global.d.ts deleted file mode 100644 index 22d2be56..00000000 --- a/src/types/global.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type { QueryExecResult, SqlValue } from "./database"; - -declare module '@jlongster/sql.js' { - interface SQL { - Database: new (path: string, options?: { filename: boolean }) => Database; - FS: { - mkdir: (path: string) => void; - mount: (fs: any, options: any, path: string) => void; - open: (path: string, flags: string) => any; - close: (stream: any) => void; - }; - register_for_idb: (fs: any) => void; - } - - interface Database { - exec: (sql: string, params?: unknown[]) => Promise; - run: (sql: string, params?: unknown[]) => Promise<{ changes: number; lastId?: number }>; - get: (sql: string, params?: unknown[]) => Promise; - all: (sql: string, params?: unknown[]) => Promise; - prepare: (sql: string) => Promise; - close: () => void; - } - - interface Statement { - run: (params?: unknown[]) => Promise<{ changes: number; lastId?: number }>; - get: (params?: unknown[]) => Promise; - all: (params?: unknown[]) => Promise; - finalize: () => void; - } - - const initSqlJs: (options?: { - locateFile?: (file: string) => string; - }) => Promise; - - export default initSqlJs; -} - -/** - * Electron API types for the main world context bridge. - * - * These types define the secure IPC APIs exposed by the preload script - * to the renderer process for native Electron functionality. - */ -interface ElectronAPI { - /** - * Export data to the user's Downloads folder. - * - * @param fileName - The name of the file to save (e.g., 'backup-2025-07-06.json') - * @param data - The content to write to the file (string) - * @returns Promise with success status, file path, or error message - */ - exportData: (fileName: string, data: string) => Promise<{ - success: boolean; - path?: string; - error?: string; - }>; -} - -/** - * Global window interface extension for Electron APIs. - * - * This makes the electronAPI available on the window object - * in TypeScript without type errors. - */ -declare global { - interface Window { - electronAPI: ElectronAPI; - } -} - -/** - * Vue instance interface extension for global properties. - * - * This makes global properties available on Vue instances - * in TypeScript without type errors. - */ -declare module 'vue' { - interface ComponentCustomProperties { - $notify: (notification: any, timeout?: number) => void; - $route: import('vue-router').RouteLocationNormalizedLoaded; - $router: import('vue-router').Router; - } -} \ No newline at end of file diff --git a/src/types/modules.d.ts b/src/types/modules.d.ts deleted file mode 100644 index 62eb3f8e..00000000 --- a/src/types/modules.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type { QueryExecResult, SqlValue } from "./database"; - -declare module '@jlongster/sql.js' { - interface SQL { - Database: new (path: string, options?: { filename: boolean }) => Database; - FS: { - mkdir: (path: string) => void; - mount: (fs: any, options: any, path: string) => void; - open: (path: string, flags: string) => any; - close: (stream: any) => void; - }; - register_for_idb: (fs: any) => void; - } - - interface Database { - exec: (sql: string, params?: unknown[]) => Promise; - run: (sql: string, params?: unknown[]) => Promise<{ changes: number; lastId?: number }>; - get: (sql: string, params?: unknown[]) => Promise; - all: (sql: string, params?: unknown[]) => Promise; - prepare: (sql: string) => Promise; - close: () => void; - } - - interface Statement { - run: (params?: unknown[]) => Promise<{ changes: number; lastId?: number }>; - get: (params?: unknown[]) => Promise; - all: (params?: unknown[]) => Promise; - finalize: () => void; - } - - const initSqlJs: (options?: { - locateFile?: (file: string) => string; - }) => Promise; - - export default initSqlJs; -} - -declare module 'absurd-sql' { - import type { SQL } from '@jlongster/sql.js'; - export class SQLiteFS { - constructor(fs: any, backend: any); - } -} - -declare module 'absurd-sql/dist/indexeddb-backend' { - export default class IndexedDBBackend { - constructor(); - } -} - -declare module 'absurd-sql/dist/indexeddb-main-thread' { - import type { QueryExecResult } from './database'; - export interface SQLiteOptions { - filename?: string; - autoLoad?: boolean; - debug?: boolean; - } - - export interface SQLiteDatabase { - exec: (sql: string, params?: unknown[]) => Promise; - close: () => Promise; - } - - export function initSqlJs(options?: any): Promise; - export function createDatabase(options?: SQLiteOptions): Promise; - export function openDatabase(options?: SQLiteOptions): Promise; -} \ No newline at end of file