Skip to content

Commit b3305ae

Browse files
authored
Merge pull request #84 from jonvuri/bigint-types
Correct 'BigInt' types to 'bigint' (and add Typescript checking script)
2 parents 60fc2d3 + 2c8c261 commit b3305ae

File tree

4 files changed

+50
-27
lines changed

4 files changed

+50
-27
lines changed

index.d.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ declare type SqlValue =
33
| string
44
| number
55
| null
6-
| BigInt
6+
| bigint
77
| Uint8Array
88
| Int8Array
99
| ArrayBuffer;
@@ -1870,9 +1870,9 @@ declare class sqlite3_index_info extends SQLiteStruct {
18701870
needToFreeIdxStr: number;
18711871
orderByConsumed: number;
18721872
estimatedCost: number;
1873-
estimatedRows: BigInt;
1873+
estimatedRows: bigint;
18741874
idxFlags: number;
1875-
colUsed: BigInt;
1875+
colUsed: bigint;
18761876
sqlite3_index_constraint: sqlite3_index_constraint;
18771877
sqlite3_index_orderby: sqlite3_index_orderby;
18781878
sqlite3_index_constraint_usage: sqlite3_index_constraint_usage;
@@ -2713,7 +2713,7 @@ declare type WASM_API = {
27132713
* Equivalent to peek(X,'i64'). Will throw if the environment is not
27142714
* configured with BigInt support.
27152715
*/
2716-
peek64: (addr: WasmPointer) => BigInt;
2716+
peek64: (addr: WasmPointer) => bigint;
27172717

27182718
/** Equivalent to peek(X,'f32') */
27192719
peek32f: (addr: WasmPointer) => number;
@@ -3528,7 +3528,7 @@ declare type CAPI = {
35283528
arg1: number,
35293529
arg2: number,
35303530
): number;
3531-
sqlite3_config(op: CAPI['SQLITE_CONFIG_MEMDB_MAXSIZE'], arg: BigInt): number;
3531+
sqlite3_config(op: CAPI['SQLITE_CONFIG_MEMDB_MAXSIZE'], arg: bigint): number;
35323532

35333533
/**
35343534
* Used to make configuration changes to a database connection. The interface
@@ -3595,7 +3595,7 @@ declare type CAPI = {
35953595
*
35963596
* See https://www.sqlite.org/c3ref/last_insert_rowid.html
35973597
*/
3598-
sqlite3_last_insert_rowid: (db: Database | WasmPointer) => BigInt;
3598+
sqlite3_last_insert_rowid: (db: Database | WasmPointer) => bigint;
35993599

36003600
/**
36013601
* Allows the application to set the value returned by calling
@@ -3610,7 +3610,7 @@ declare type CAPI = {
36103610
*/
36113611
sqlite3_set_last_insert_rowid: (
36123612
db: Database | WasmPointer,
3613-
rowid: BigInt,
3613+
rowid: bigint,
36143614
) => void;
36153615

36163616
/**
@@ -3641,7 +3641,7 @@ declare type CAPI = {
36413641
*
36423642
* See https://www.sqlite.org/c3ref/changes.html
36433643
*/
3644-
sqlite3_changes64: (db: Database | WasmPointer) => BigInt;
3644+
sqlite3_changes64: (db: Database | WasmPointer) => bigint;
36453645

36463646
/**
36473647
* Return the total number of rows inserted, modified or deleted by all
@@ -3673,7 +3673,7 @@ declare type CAPI = {
36733673
*
36743674
* See https://www.sqlite.org/c3ref/total_changes.html
36753675
*/
3676-
sqlite3_total_changes64: (db: Database | WasmPointer) => BigInt;
3676+
sqlite3_total_changes64: (db: Database | WasmPointer) => bigint;
36773677

36783678
/**
36793679
* Useful during command-line input to determine if the currently entered text
@@ -3753,7 +3753,7 @@ declare type CAPI = {
37533753
*
37543754
* See https://www.sqlite.org/c3ref/free.html
37553755
*/
3756-
sqlite3_malloc64: (numBytes: BigInt) => WasmPointer;
3756+
sqlite3_malloc64: (numBytes: bigint) => WasmPointer;
37573757

37583758
/**
37593759
* Attempts to resize a prior memory allocation X to be at least N bytes.
@@ -3793,7 +3793,7 @@ declare type CAPI = {
37933793
*
37943794
* See https://www.sqlite.org/c3ref/free.html
37953795
*/
3796-
sqlite3_realloc64: (ptr: WasmPointer, numBytes: BigInt) => WasmPointer;
3796+
sqlite3_realloc64: (ptr: WasmPointer, numBytes: bigint) => WasmPointer;
37973797

37983798
/**
37993799
* Calling `sqlite3_free()` with a pointer previously returned by
@@ -3828,7 +3828,7 @@ declare type CAPI = {
38283828
*
38293829
* See https://www.sqlite.org/c3ref/free.html
38303830
*/
3831-
sqlite3_msize: (ptr: WasmPointer) => BigInt;
3831+
sqlite3_msize: (ptr: WasmPointer) => bigint;
38323832

38333833
/**
38343834
* Pseudo-Random Number Generator
@@ -4014,8 +4014,8 @@ declare type CAPI = {
40144014
sqlite3_uri_int64: (
40154015
uri: string | WasmPointer,
40164016
paramName: string | WasmPointer,
4017-
defaultVal: BigInt,
4018-
) => BigInt;
4017+
defaultVal: bigint,
4018+
) => bigint;
40194019

40204020
/**
40214021
* Returns a pointer to the name (not the value) of the `idx`-th query
@@ -4322,7 +4322,7 @@ declare type CAPI = {
43224322
*
43234323
* See https://www.sqlite.org/c3ref/bind_blob.html
43244324
*/
4325-
sqlite3_bind_int64: (stmt: WasmPointer, idx: number, value: BigInt) => number;
4325+
sqlite3_bind_int64: (stmt: WasmPointer, idx: number, value: bigint) => number;
43264326

43274327
/**
43284328
* Bind a `NULL` value to a parameter in a prepared statement.
@@ -4576,7 +4576,7 @@ declare type CAPI = {
45764576
*
45774577
* See https://www.sqlite.org/c3ref/column_blob.html
45784578
*/
4579-
sqlite3_column_int64: (db: Database | WasmPointer, colIdx: number) => BigInt;
4579+
sqlite3_column_int64: (db: Database | WasmPointer, colIdx: number) => bigint;
45804580

45814581
/**
45824582
* Get a TEXT result value from a column in the current result row.
@@ -4812,7 +4812,7 @@ declare type CAPI = {
48124812
*
48134813
* See https://www.sqlite.org/c3ref/value_blob.html
48144814
*/
4815-
sqlite3_value_int64: (sqliteValue: WasmPointer) => BigInt;
4815+
sqlite3_value_int64: (sqliteValue: WasmPointer) => bigint;
48164816

48174817
/**
48184818
* Extract a pointer value from a protected `sqlite3_value` object. If the
@@ -5170,7 +5170,7 @@ declare type CAPI = {
51705170
*
51715171
* See https://www.sqlite.org/c3ref/result_blob.html
51725172
*/
5173-
sqlite3_result_int64: (ctx: WasmPointer, value: BigInt) => void;
5173+
sqlite3_result_int64: (ctx: WasmPointer, value: bigint) => void;
51745174

51755175
/**
51765176
* Sets the return value of the application-defined function to be `NULL`.
@@ -5252,7 +5252,7 @@ declare type CAPI = {
52525252
*
52535253
* See https://www.sqlite.org/c3ref/result_blob.html
52545254
*/
5255-
sqlite3_result_zeroblob64: (ctx: WasmPointer, blobLen: BigInt) => void;
5255+
sqlite3_result_zeroblob64: (ctx: WasmPointer, blobLen: bigint) => void;
52565256

52575257
/**
52585258
* Causes the subtype of the result from the application-defined SQL function
@@ -5297,7 +5297,7 @@ declare type CAPI = {
52975297
| null
52985298
| boolean
52995299
| number
5300-
| BigInt
5300+
| bigint
53015301
| string
53025302
| Uint8Array
53035303
| Int8Array
@@ -5513,7 +5513,7 @@ declare type CAPI = {
55135513
op: CAPI['SQLITE_UPDATE'] | CAPI['SQLITE_DELETE'] | CAPI['SQLITE_INSERT'],
55145514
dbName: string,
55155515
tableName: string,
5516-
newRowId: BigInt,
5516+
newRowId: bigint,
55175517
) => void,
55185518
userCtx: WasmPointer,
55195519
) => WasmPointer;
@@ -6265,8 +6265,8 @@ declare type CAPI = {
62656265
op: CAPI['SQLITE_UPDATE'] | CAPI['SQLITE_DELETE'] | CAPI['SQLITE_INSERT'],
62666266
dbName: string,
62676267
tableName: string,
6268-
oldRowid: BigInt,
6269-
newRowid: BigInt,
6268+
oldRowid: bigint,
6269+
newRowid: bigint,
62706270
) => void,
62716271
) => void;
62726272

package-lock.json

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
},
3636
"scripts": {
3737
"publint": "npx publint",
38+
"check-types": "tsc",
3839
"clean": "shx rm -rf sqlite-wasm",
3940
"build": "npm run clean && node bin/index.js",
4041
"start": "npx http-server --coop",
4142
"fix": "npx prettier . --write",
42-
"prepublishOnly": "npm run build && npm run fix && npm run publint",
43+
"prepublishOnly": "npm run build && npm run fix && npm run publint && npm run check-types",
4344
"deploy": "npm run prepare && git add . && git commit -am 'New release' && git push && npm publish --access public"
4445
},
4546
"repository": {
@@ -58,8 +59,9 @@
5859
"module-workers-polyfill": "^0.3.2",
5960
"node-fetch": "^3.3.2",
6061
"prettier": "^3.3.3",
61-
"publint": "^0.2.10",
6262
"prettier-plugin-jsdoc": "^1.3.0",
63-
"shx": "^0.3.4"
63+
"publint": "^0.2.10",
64+
"shx": "^0.3.4",
65+
"typescript": "^5.5.4"
6466
}
6567
}

tsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2020",
4+
"noEmit": true,
5+
"strict": true
6+
}
7+
}

0 commit comments

Comments
 (0)