Skip to content

Commit

Permalink
Added generic type annotations for Statement and Database get/all/eac…
Browse files Browse the repository at this point in the history
…h methods callback rows (#1686)

* 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

* 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
  • Loading branch information
stevescruz committed Mar 13, 2023
1 parent 6a806f8 commit 46da1ab
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/sqlite3.d.ts
Expand Up @@ -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<T>(callback?: (err: Error | null, row?: T) => void): this;
get<T>(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<T>(callback?: (err: Error | null, rows: T[]) => void): this;
all<T>(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<T>(callback?: (err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
each<T>(params: any, callback?: (this: RunResult, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
each(...params: any[]): this;
}

Expand All @@ -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<T>(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void): this;
get<T>(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<T>(sql: string, callback?: (this: Statement, err: Error | null, rows: T[]) => void): this;
all<T>(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<T>(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
each<T>(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;
Expand Down

0 comments on commit 46da1ab

Please sign in to comment.