forked from jsnbuchanan/crowd-funder-for-time-pwa
refactor(db): improve type safety in migration system
- Replace any[] with SqlValue[] type for SQL parameters in runMigrations - Update import to use QueryExecResult from interfaces/database - Add proper typing for SQL parameter values (string | number | null | Uint8Array) This change improves type safety and helps catch potential SQL parameter type mismatches at compile time, reducing the risk of runtime errors or data corruption.
This commit is contained in:
@@ -7,11 +7,11 @@ export interface QueryExecResult {
|
||||
|
||||
export interface DatabaseService {
|
||||
initialize(): Promise<void>;
|
||||
query(sql: string, params?: any[]): Promise<QueryExecResult[]>;
|
||||
query(sql: string, params?: unknown[]): Promise<QueryExecResult[]>;
|
||||
run(
|
||||
sql: string,
|
||||
params?: any[],
|
||||
params?: unknown[],
|
||||
): Promise<{ changes: number; lastId?: number }>;
|
||||
getOneRow(sql: string, params?: any[]): Promise<any[] | undefined>;
|
||||
getAll(sql: string, params?: any[]): Promise<any[][]>;
|
||||
getOneRow(sql: string, params?: unknown[]): Promise<unknown[] | undefined>;
|
||||
getAll(sql: string, params?: unknown[]): Promise<unknown[][]>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user