diff --git a/index.d.ts b/index.d.ts index 07441983..9a1642aa 100644 --- a/index.d.ts +++ b/index.d.ts @@ -19,7 +19,7 @@ type ArgumentTypes = F extends (...args: infer A) type ElementOf = T extends Array ? E : T; declare namespace BetterSqlite3MultipleCiphers { - interface Statement { + interface Statement { database: Database; source: string; reader: boolean; @@ -27,9 +27,9 @@ declare namespace BetterSqlite3MultipleCiphers { busy: boolean; run(...params: BindParameters): Database.RunResult; - get(...params: BindParameters): unknown; - all(...params: BindParameters): unknown[]; - iterate(...params: BindParameters): IterableIterator; + get(...params: BindParameters): Result | undefined; + all(...params: BindParameters): Result[]; + iterate(...params: BindParameters): IterableIterator; pluck(toggleState?: boolean): this; expand(toggleState?: boolean): this; raw(toggleState?: boolean): this; @@ -69,9 +69,9 @@ declare namespace BetterSqlite3MultipleCiphers { open: boolean; inTransaction: boolean; - prepare( + prepare( source: string, - ): BindParameters extends unknown[] ? Statement : Statement<[BindParameters]>; + ): BindParameters extends unknown[] ? Statement : Statement<[BindParameters], Result>; transaction(fn: F): Transaction; exec(source: string): this; key(key: Buffer): number; @@ -79,12 +79,15 @@ declare namespace BetterSqlite3MultipleCiphers { pragma(source: string, options?: Database.PragmaOptions): unknown; function(name: string, cb: (...params: unknown[]) => unknown): this; function(name: string, options: Database.RegistrationOptions, cb: (...params: unknown[]) => unknown): this; - aggregate(name: string, options: Database.RegistrationOptions & { - start?: T | (() => T); - step: (total: T, next: ElementOf) => T | void; - inverse?: ((total: T, dropped: T) => T) | undefined; - result?: ((total: T) => unknown) | undefined; - }): this; + aggregate( + name: string, + options: Database.RegistrationOptions & { + start?: T | (() => T); + step: (total: T, next: ElementOf) => T | void; + inverse?: ((total: T, dropped: T) => T) | undefined; + result?: ((total: T) => unknown) | undefined; + }, + ): this; loadExtension(path: string): this; close(): this; defaultSafeIntegers(toggleState?: boolean): this; @@ -95,7 +98,7 @@ declare namespace BetterSqlite3MultipleCiphers { } interface DatabaseConstructor { - new (filename: string | Buffer, options?: Database.Options): Database; + new(filename: string | Buffer, options?: Database.Options): Database; (filename: string, options?: Database.Options): Database; prototype: Database; @@ -150,10 +153,9 @@ declare namespace Database { } type SqliteError = typeof SqliteError; - type Statement = BindParameters extends unknown[] - ? BetterSqlite3MultipleCiphers.Statement - : BetterSqlite3MultipleCiphers.Statement<[BindParameters]>; - type ColumnDefinition = BetterSqlite3MultipleCiphers.ColumnDefinition; + type Statement = BindParameters extends unknown[] ? + BetterSqlite3MultipleCiphers.Statement : + BetterSqlite3MultipleCiphers.Statement<[BindParameters], Result>; type Transaction = BetterSqlite3MultipleCiphers.Transaction; type Database = BetterSqlite3MultipleCiphers.Database; }