import { BindParams, Row } from '../../util/types.js'; import type { Database as OriginalDatabase, Statement as OriginalStatement, Transaction, RunResult } from 'better-sqlite3'; export type { Transaction }; export interface Database extends Pick { exec(sql: string): this; } export type StatementBindParams = T extends any[] ? T : [T]; type BoundStatement = Omit, 'run' | 'get' | 'all' | 'iterate'> & { run: (...params: T) => RunResult; get: (...params: T) => Row | undefined; all: (...params: T) => Row[]; iterate: (...params: T) => IterableIterator; }; export type Statement = T extends any[] ? BoundStatement : BoundStatement<[T], Result>;