You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
issue with node:sqlite; [Symbol.dispose] missing in type 'StatementSync', property close was not found in type StatementSync #5169
Im trying to create a database controler object like below.
I have two errors;
The initializer of a 'using' declaration must be either an object with a 'Symbol.dispose' method, or be 'null' or 'undefined'.
Property '[Symbol.dispose]' is missing in type 'StatementSync' but required in type 'Disposable'.
Property 'close' does not exist on type 'StatementSync'.
dependencies
node
26.8.1
npm
11.19.0
@types/node
26.4.1
I know the cause that version of @types/node is below but I'm not sure how I can update it.
//@ts-checkimport{DatabaseSync}from"node:sqlite";classa{constructor(){this.db=newDatabaseSync("<path>");this.db.exec("CREATE TABLE IF NOT EXISTS t (name TEXT)");}/** * * @param {string} n */post1(n){usinginsert=this.db.prepare("INSERT INTO t(name) VALUES(?)");// <--insert.run("bob");}/** * * @param {string} n */post2(n){constinsert=this.db.prepare("INSERT INTO t(name) VALUES(?)");insert.run("maria");insert.close();// <--}}
Minimal Reproduction
npm init -y
then npm i @types/node
Output
The initializer of a 'using' declaration must be either an object with a 'Symbol.dispose' method, or be 'null' or 'undefined'.
Property '[Symbol.dispose]' is missing in type 'StatementSync' but required in type 'Disposable'.
Property 'close' does not exist on type 'StatementSync'.
Before You Submit
I have looked for issues that already exist before submitting this
Activity