AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.
I first copied over the alasql.d.ts to src directory, then add the following to package.json
"typings": "src/alasql.d.ts",
Then my code looks like this.
import * as alasql from "alasql";
export function someFunction(): void {
const body = document.getElementsByTagName("body")[0];
body.style.backgroundColor = "lightblue";
}
export function dbInit(): void {
alasql.parse("CREATE TABLE cities (city string, population number)");
alasql.parse(
"INSERT INTO cities VALUES ('Rome',2863223), ('Paris',2249975), ('Berlin',3517424), ('Madrid',3041579)"
);
var res = alasql.parse(
"SELECT * FROM cities WHERE population < 3500000 ORDER BY population DESC"
);
console.log(res);
}
However i seem to get the following error after compiling ts and running. The error can be seen on chrome console.
Uncaught TypeError: Failed to resolve module specifier "alasql". Relative references must start with either "/", "./", or "../".
Im currently setting up a simple typescript project using alasql.
Im using this as a template.
https://github.com/aleph-naught2tog/ts_without_dependencies
I first copied over the alasql.d.ts to src directory, then add the following to package.json
Then my code looks like this.
However i seem to get the following error after compiling ts and running. The error can be seen on chrome console.