Skip to content

Commit 375bdba

Browse files
committed
Improvements to TypeScript types (thanks @sampbarrow)
- Use `readonly T[]` argument types where possible - Fix typo in first `xWrapped` overload - Include `BigInt` in `SqlValue` union type
1 parent bf4b0e0 commit 375bdba

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

index.d.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ declare type SqlValue =
33
| string
44
| number
55
| null
6+
| BigInt
67
| Uint8Array
78
| Int8Array
89
| ArrayBuffer;
@@ -17,7 +18,7 @@ declare type SQLiteDataType =
1718

1819
/** Specifies parameter bindings. */
1920
declare type BindingSpec =
20-
| SqlValue[]
21+
| readonly SqlValue[]
2122
| { [paramName: string]: SqlValue }
2223
/** Assumed to have binding index `1` */
2324
| SqlValue;
@@ -45,7 +46,7 @@ declare type FlexibleString =
4546
* string literals with the backtick syntax, it is frequently convenient to
4647
* write out longer SQL constructs as arrays.
4748
*/
48-
| string[];
49+
| readonly string[];
4950

5051
/**
5152
* Prepared statements are created solely through the {@link Database#prepare}
@@ -2995,16 +2996,16 @@ declare type WASM_API = {
29952996
* calls, however, this variant is arguably more efficient because it will
29962997
* hypothetically free the wrapper function quickly.
29972998
*/
2998-
xCallWrappe(
2999+
xCallWrapped(
29993000
functionName: string,
30003001
resultType: string,
3001-
argTypes: string[],
3002+
argTypes: readonly string[],
30023003
...args: any[]
30033004
): any;
30043005
xCallWrapped(
30053006
functionName: string,
30063007
resultType: string,
3007-
argTypes: string[],
3008+
argTypes: readonly string[],
30083009
args: any[],
30093010
): any;
30103011

@@ -3200,12 +3201,12 @@ declare type WASM_API = {
32003201
xWrap(
32013202
functionName: string,
32023203
resultType: string | undefined,
3203-
...argTypes: string[]
3204+
...argTypes: readonly string[]
32043205
): Function;
32053206
xWrap(
32063207
functionName: string,
32073208
resultType: string | undefined,
3208-
argTypes: string[],
3209+
argTypes: readonly string[],
32093210
): Function;
32103211

32113212
/* --------------------------------------------------------------------------
@@ -4214,7 +4215,7 @@ declare type CAPI = {
42144215
blob:
42154216
| WasmPointer
42164217
| string
4217-
| string[]
4218+
| readonly string[]
42184219
| Int8Array
42194220
| Uint8Array
42204221
| ArrayBuffer,
@@ -4305,7 +4306,7 @@ declare type CAPI = {
43054306
text:
43064307
| string
43074308
| WasmPointer
4308-
| string[]
4309+
| readonly string[]
43094310
| Int8Array
43104311
| Uint8Array
43114312
| ArrayBuffer,

0 commit comments

Comments
 (0)