I'm in the process of converting my JavaScript code to TypeScript. One of the libraries I rely on is sql.js. I have successfully installed the corresponding typing for it, but I am facing a roadblock when it comes to creating the database.
Here is how it was done in JS:
var db = new SQL.Database();
db.run('CREATE TABLE snapshots (dateTime LONGINT, snapshot BLOB)');
The sql.js/index.d.ts file does not have a parameterless constructor:
class Database {
constructor(data: Buffer);
constructor(data: Uint8Array);
constructor(data: number[]);
run(sql: string): Database;
...
}
How do I create an empty db object? What are the purposes of these parameters in the constructor overrides?