Skip to content

Commit 1de58a6

Browse files
authored
🤖 Merge PR DefinitelyTyped#72396 fix(better-sqlite3): use any instead of unknown for function() by @hkleungai
1 parent 91f03a2 commit 1de58a6

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

‎types/better-sqlite3/better-sqlite3-tests.ts‎

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,30 @@ db.table("vtable_parameters", {
3131
yield { name: name };
3232
},
3333
});
34-
db.function("noop", () => {});
35-
db.function("noop", {
36-
deterministic: true,
37-
varargs: true,
38-
directOnly: true,
39-
}, () => {});
34+
db.function("fn", () => {});
35+
db.function("fn", (a: number) => a + 123);
36+
db.function("fn", {}, () => {});
37+
db.function("fn", {}, (a: number) => a + 123);
38+
db.function(
39+
"fn",
40+
{
41+
varargs: true,
42+
deterministic: true,
43+
safeIntegers: true,
44+
directOnly: true,
45+
},
46+
() => {},
47+
);
48+
db.function(
49+
"fn",
50+
{
51+
varargs: true,
52+
deterministic: true,
53+
safeIntegers: true,
54+
directOnly: true,
55+
},
56+
(a: number) => a + 123,
57+
);
4058
db.aggregate("add", {
4159
start: 0,
4260
step: (t, n) => t + n,

‎types/better-sqlite3/index.d.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,15 @@ declare namespace BetterSqlite3 {
6262
transaction<F extends VariableArgFunction>(fn: F): Transaction<F>;
6363
exec(source: string): this;
6464
pragma(source: string, options?: Database.PragmaOptions): unknown;
65-
function(name: string, cb: (...params: unknown[]) => unknown): this;
66-
function(name: string, options: Database.RegistrationOptions, cb: (...params: unknown[]) => unknown): this;
65+
function(
66+
name: string,
67+
cb: (...params: any[]) => any,
68+
): this;
69+
function(
70+
name: string,
71+
options: Database.RegistrationOptions,
72+
cb: (...params: any[]) => any,
73+
): this;
6774
aggregate<T>(
6875
name: string,
6976
options: Database.RegistrationOptions & {

0 commit comments

Comments
 (0)