I might be approaching this completely incorrectly, so any advice is appreciated. I'm currently trying to dig in deep to Typescript, and have decided to simultaneously use Sql.js (the JS version of SQLite) at the same time...
My first instinct to use Sql.js was to search for a .d.ts set of bindings around Sql.js so that I could easily start using it with TS. I've come up with no bindings so far (I don't think one exists yet), but figured I could just start "define"-ing in the stuff that I need from the library...
Starting with one of the simple examples from the "sql.js" docs, you have something like this:
var sql = window.SQL;
var db = new sql.Database();
declare var window.SQL : any;
declare var window.SQL;
declare var SQL = window.SQL;
declare window.SQL;
window
is declared to be of type interface Window
(in lib.d.ts). So you need to add to that if you want to use window.SQL
:
interface Window{
SQL:any;
}
var sql = window.SQL;
var db = new sql.Database();
Personally I would recommend not using it off of window
and just do
declare var SQL:any;
var db = new SQL.Database();
By default the variable access in the browser is on window
.