From 9c11561b3fb04c8523f1e8f37dcca8a1ba36e3ee Mon Sep 17 00:00:00 2001 From: Florian Klampfer Date: Sun, 19 May 2024 10:42:03 +0700 Subject: [PATCH 1/3] Improve types --- index.d.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 889fc85..322d240 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2032,7 +2032,15 @@ declare type Sqlite3Static = { installVfs: (obj: { io?: { struct: sqlite3_io_methods; - methods: Omit; + methods: { [K in keyof sqlite3_io_methods as K extends `x${string}` ? K : never]?: sqlite3_io_methods[K] }; + applyArgcCheck?: boolean; + }; + vfs?: { + struct: sqlite3_vfs; + methods: { [K in keyof sqlite3_vfs as K extends `x${string}` ? K : never]?: sqlite3_vfs[K] }; + applyArgcCheck?: boolean; + name?: string; + asDefault?: boolean; }; }) => Sqlite3Static['vfs']; }; @@ -2792,7 +2800,7 @@ declare type WASM_API = { poke32: (addr: WasmPointer, value: number) => WASM_API; /** Equivalent to poke(X,Y,'i64') */ - poke64: (addr: WasmPointer, value: number) => WASM_API; + poke64: (addr: WasmPointer, value: number|bigint) => WASM_API; /** Equivalent to poke(X,Y,'f32') */ poke32f: (addr: WasmPointer, value: number) => WASM_API; @@ -5729,7 +5737,7 @@ declare type CAPI = { * * See https://www.sqlite.org/c3ref/vfs_find.html */ - sqlite3_vfs_find: (vfsName: string) => sqlite3_vfs; + sqlite3_vfs_find: (vfsName: string|null) => number; /** * Register a new VFS. Becomes the default if the makeDflt parameter is set. From 34935542f1c565c89d7ad030f526b190c69a76d0 Mon Sep 17 00:00:00 2001 From: Florian Klampfer Date: Sun, 19 May 2024 10:47:26 +0700 Subject: [PATCH 2/3] Prefer WasmPointer --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 322d240..b6bf10c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -5737,7 +5737,7 @@ declare type CAPI = { * * See https://www.sqlite.org/c3ref/vfs_find.html */ - sqlite3_vfs_find: (vfsName: string|null) => number; + sqlite3_vfs_find: (vfsName: string|null) => WasmPointer; /** * Register a new VFS. Becomes the default if the makeDflt parameter is set. From fce37ddeab14863871d047efa2d211e96585b1e8 Mon Sep 17 00:00:00 2001 From: Florian Klampfer Date: Mon, 20 May 2024 22:54:15 +0700 Subject: [PATCH 3/3] Make opfs flags optional --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index b6bf10c..80fe57c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1244,7 +1244,7 @@ declare class OpfsDatabase extends Database { * `c`. These modes are ignored for the special `":memory:"` and `""` * names and may be ignored by specific VFSes. */ - constructor(filename: string, flags: string); + constructor(filename: string, flags?: string); /** * Import a database into OPFS storage. It only works with database files and