Skip to content

Correct 'BigInt' types to 'bigint' (and add Typescript checking script) #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ declare type SqlValue =
| string
| number
| null
| BigInt
| bigint
| Uint8Array
| Int8Array
| ArrayBuffer;
Expand Down Expand Up @@ -1862,9 +1862,9 @@ declare class sqlite3_index_info extends SQLiteStruct {
needToFreeIdxStr: number;
orderByConsumed: number;
estimatedCost: number;
estimatedRows: BigInt;
estimatedRows: bigint;
idxFlags: number;
colUsed: BigInt;
colUsed: bigint;
sqlite3_index_constraint: sqlite3_index_constraint;
sqlite3_index_orderby: sqlite3_index_orderby;
sqlite3_index_constraint_usage: sqlite3_index_constraint_usage;
Expand Down Expand Up @@ -2705,7 +2705,7 @@ declare type WASM_API = {
* Equivalent to peek(X,'i64'). Will throw if the environment is not
* configured with BigInt support.
*/
peek64: (addr: WasmPointer) => BigInt;
peek64: (addr: WasmPointer) => bigint;

/** Equivalent to peek(X,'f32') */
peek32f: (addr: WasmPointer) => number;
Expand Down Expand Up @@ -3520,7 +3520,7 @@ declare type CAPI = {
arg1: number,
arg2: number,
): number;
sqlite3_config(op: CAPI['SQLITE_CONFIG_MEMDB_MAXSIZE'], arg: BigInt): number;
sqlite3_config(op: CAPI['SQLITE_CONFIG_MEMDB_MAXSIZE'], arg: bigint): number;

/**
* Used to make configuration changes to a database connection. The interface
Expand Down Expand Up @@ -3587,7 +3587,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/last_insert_rowid.html
*/
sqlite3_last_insert_rowid: (db: Database | WasmPointer) => BigInt;
sqlite3_last_insert_rowid: (db: Database | WasmPointer) => bigint;

/**
* Allows the application to set the value returned by calling
Expand All @@ -3602,7 +3602,7 @@ declare type CAPI = {
*/
sqlite3_set_last_insert_rowid: (
db: Database | WasmPointer,
rowid: BigInt,
rowid: bigint,
) => void;

/**
Expand Down Expand Up @@ -3633,7 +3633,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/changes.html
*/
sqlite3_changes64: (db: Database | WasmPointer) => BigInt;
sqlite3_changes64: (db: Database | WasmPointer) => bigint;

/**
* Return the total number of rows inserted, modified or deleted by all
Expand Down Expand Up @@ -3665,7 +3665,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/total_changes.html
*/
sqlite3_total_changes64: (db: Database | WasmPointer) => BigInt;
sqlite3_total_changes64: (db: Database | WasmPointer) => bigint;

/**
* Useful during command-line input to determine if the currently entered text
Expand Down Expand Up @@ -3745,7 +3745,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/free.html
*/
sqlite3_malloc64: (numBytes: BigInt) => WasmPointer;
sqlite3_malloc64: (numBytes: bigint) => WasmPointer;

/**
* Attempts to resize a prior memory allocation X to be at least N bytes.
Expand Down Expand Up @@ -3785,7 +3785,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/free.html
*/
sqlite3_realloc64: (ptr: WasmPointer, numBytes: BigInt) => WasmPointer;
sqlite3_realloc64: (ptr: WasmPointer, numBytes: bigint) => WasmPointer;

/**
* Calling `sqlite3_free()` with a pointer previously returned by
Expand Down Expand Up @@ -3820,7 +3820,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/free.html
*/
sqlite3_msize: (ptr: WasmPointer) => BigInt;
sqlite3_msize: (ptr: WasmPointer) => bigint;

/**
* Pseudo-Random Number Generator
Expand Down Expand Up @@ -4006,8 +4006,8 @@ declare type CAPI = {
sqlite3_uri_int64: (
uri: string | WasmPointer,
paramName: string | WasmPointer,
defaultVal: BigInt,
) => BigInt;
defaultVal: bigint,
) => bigint;

/**
* Returns a pointer to the name (not the value) of the `idx`-th query
Expand Down Expand Up @@ -4314,7 +4314,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/bind_blob.html
*/
sqlite3_bind_int64: (stmt: WasmPointer, idx: number, value: BigInt) => number;
sqlite3_bind_int64: (stmt: WasmPointer, idx: number, value: bigint) => number;

/**
* Bind a `NULL` value to a parameter in a prepared statement.
Expand Down Expand Up @@ -4568,7 +4568,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/column_blob.html
*/
sqlite3_column_int64: (db: Database | WasmPointer, colIdx: number) => BigInt;
sqlite3_column_int64: (db: Database | WasmPointer, colIdx: number) => bigint;

/**
* Get a TEXT result value from a column in the current result row.
Expand Down Expand Up @@ -4804,7 +4804,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/value_blob.html
*/
sqlite3_value_int64: (sqliteValue: WasmPointer) => BigInt;
sqlite3_value_int64: (sqliteValue: WasmPointer) => bigint;

/**
* Extract a pointer value from a protected `sqlite3_value` object. If the
Expand Down Expand Up @@ -5162,7 +5162,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/result_blob.html
*/
sqlite3_result_int64: (ctx: WasmPointer, value: BigInt) => void;
sqlite3_result_int64: (ctx: WasmPointer, value: bigint) => void;

/**
* Sets the return value of the application-defined function to be `NULL`.
Expand Down Expand Up @@ -5244,7 +5244,7 @@ declare type CAPI = {
*
* See https://www.sqlite.org/c3ref/result_blob.html
*/
sqlite3_result_zeroblob64: (ctx: WasmPointer, blobLen: BigInt) => void;
sqlite3_result_zeroblob64: (ctx: WasmPointer, blobLen: bigint) => void;

/**
* Causes the subtype of the result from the application-defined SQL function
Expand Down Expand Up @@ -5289,7 +5289,7 @@ declare type CAPI = {
| null
| boolean
| number
| BigInt
| bigint
| string
| Uint8Array
| Int8Array
Expand Down Expand Up @@ -5505,7 +5505,7 @@ declare type CAPI = {
op: CAPI['SQLITE_UPDATE'] | CAPI['SQLITE_DELETE'] | CAPI['SQLITE_INSERT'],
dbName: string,
tableName: string,
newRowId: BigInt,
newRowId: bigint,
) => void,
userCtx: WasmPointer,
) => WasmPointer;
Expand Down Expand Up @@ -6257,8 +6257,8 @@ declare type CAPI = {
op: CAPI['SQLITE_UPDATE'] | CAPI['SQLITE_DELETE'] | CAPI['SQLITE_INSERT'],
dbName: string,
tableName: string,
oldRowid: BigInt,
newRowid: BigInt,
oldRowid: bigint,
newRowid: bigint,
) => void,
) => void;

Expand Down
16 changes: 15 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@
},
"scripts": {
"publint": "npx publint",
"check-types": "tsc",
"clean": "shx rm -rf sqlite-wasm",
"build": "npm run clean && node bin/index.js",
"start": "npx http-server --coop",
"fix": "npx prettier . --write",
"prepublishOnly": "npm run build && npm run fix && npm run publint",
"prepublishOnly": "npm run build && npm run fix && npm run publint && npm run check-types",
"deploy": "npm run prepare && git add . && git commit -am 'New release' && git push && npm publish --access public"
},
"repository": {
Expand All @@ -58,8 +59,9 @@
"module-workers-polyfill": "^0.3.2",
"node-fetch": "^3.3.2",
"prettier": "^3.3.3",
"publint": "^0.2.10",
"prettier-plugin-jsdoc": "^1.3.0",
"shx": "^0.3.4"
"publint": "^0.2.10",
"shx": "^0.3.4",
"typescript": "^5.5.4"
}
}
7 changes: 7 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"target": "es2020",
"noEmit": true,
"strict": true
}
}