mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-28 16:49:50 -07:00
651e541ea8
- Extract types → history-types.ts, DB layer → history-db.ts, navigation → history-navigation.ts - history.ts becomes a re-export barrel - Fix findNextEpisode: deleted-file fallback now advances to next season - Add isReadonlyWalRetryError (WAL-mode guard before read-write retry) - Strengthen bun-sqlite.d.ts with generics on Statement/query/prepare
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
// Minimal ambient typing for bun:sqlite. The launcher always runs under bun
|
|
// (see the build banner in package.json), but the repo typechecks with plain
|
|
// tsc which has no bun type definitions.
|
|
declare module 'bun:sqlite' {
|
|
export interface RunResult {
|
|
changes: number;
|
|
lastInsertRowid: number | bigint;
|
|
}
|
|
|
|
export interface Statement<ReturnType = unknown, ParamsType extends unknown[] = unknown[]> {
|
|
all(...params: ParamsType): ReturnType[];
|
|
get(...params: ParamsType): ReturnType | undefined;
|
|
run(...params: ParamsType): RunResult;
|
|
}
|
|
|
|
export class Database {
|
|
constructor(
|
|
filename: string,
|
|
options?: { readonly?: boolean; readwrite?: boolean; create?: boolean },
|
|
);
|
|
query<ReturnType = unknown, ParamsType extends unknown[] = unknown[]>(
|
|
sql: string,
|
|
): Statement<ReturnType, ParamsType>;
|
|
prepare<ReturnType = unknown, ParamsType extends unknown[] = unknown[]>(
|
|
sql: string,
|
|
): Statement<ReturnType, ParamsType>;
|
|
run(sql: string, ...params: unknown[]): RunResult;
|
|
close(throwOnError?: boolean): void;
|
|
}
|
|
}
|