From 223841c8eaf9c2d172e1691a250f42e84ed82800 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 23 Feb 2023 18:35:20 -0800 Subject: [PATCH 1/2] Change sqlite3.d.ts to add generic type definition support for Statement methods -For get method callback's row -For all method callback's rows -For each method callback's row --- lib/sqlite3.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/sqlite3.d.ts b/lib/sqlite3.d.ts index b27b0cf51..1b407179e 100644 --- a/lib/sqlite3.d.ts +++ b/lib/sqlite3.d.ts @@ -80,16 +80,16 @@ export class Statement extends events.EventEmitter { run(params: any, callback?: (this: RunResult, err: Error | null) => void): this; run(...params: any[]): this; - get(callback?: (err: Error | null, row?: any) => void): this; - get(params: any, callback?: (this: RunResult, err: Error | null, row?: any) => void): this; + get(callback?: (err: Error | null, row?: T) => void): this; + get(params: any, callback?: (this: RunResult, err: Error | null, row?: T) => void): this; get(...params: any[]): this; - all(callback?: (err: Error | null, rows: any[]) => void): this; - all(params: any, callback?: (this: RunResult, err: Error | null, rows: any[]) => void): this; + all(callback?: (err: Error | null, rows: T[]) => void): this; + all(params: any, callback?: (this: RunResult, err: Error | null, rows: T[]) => void): this; all(...params: any[]): this; - each(callback?: (err: Error | null, row: any) => void, complete?: (err: Error | null, count: number) => void): this; - each(params: any, callback?: (this: RunResult, err: Error | null, row: any) => void, complete?: (err: Error | null, count: number) => void): this; + each(callback?: (err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this; + each(params: any, callback?: (this: RunResult, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this; each(...params: any[]): this; } From d1d22b7ad59269ac34f696ab95b522b9d23ef488 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 23 Feb 2023 18:39:31 -0800 Subject: [PATCH 2/2] Change sqlite3.d.ts to add generic type definition support for Database methods -For get method callback's row -For all method callback's rows -For each method callback's row --- lib/sqlite3.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/sqlite3.d.ts b/lib/sqlite3.d.ts index 1b407179e..15e66230e 100644 --- a/lib/sqlite3.d.ts +++ b/lib/sqlite3.d.ts @@ -103,16 +103,16 @@ export class Database extends events.EventEmitter { run(sql: string, params: any, callback?: (this: RunResult, err: Error | null) => void): this; run(sql: string, ...params: any[]): this; - get(sql: string, callback?: (this: Statement, err: Error | null, row: any) => void): this; - get(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: any) => void): this; + get(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void): this; + get(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: T) => void): this; get(sql: string, ...params: any[]): this; - all(sql: string, callback?: (this: Statement, err: Error | null, rows: any[]) => void): this; - all(sql: string, params: any, callback?: (this: Statement, err: Error | null, rows: any[]) => void): this; + all(sql: string, callback?: (this: Statement, err: Error | null, rows: T[]) => void): this; + all(sql: string, params: any, callback?: (this: Statement, err: Error | null, rows: T[]) => void): this; all(sql: string, ...params: any[]): this; - each(sql: string, callback?: (this: Statement, err: Error | null, row: any) => void, complete?: (err: Error | null, count: number) => void): this; - each(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: any) => void, complete?: (err: Error | null, count: number) => void): this; + each(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this; + each(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this; each(sql: string, ...params: any[]): this; exec(sql: string, callback?: (this: Statement, err: Error | null) => void): this;