I am writing an app in electron using angular 4. I need a database and want to use websql but I cannot find a way to import websql typings.
I added @types/websql. In my IDE, there is no compil error when i do :
const db: Database = window.openDatabase('foo', '1.0', 'foo', 2 * 1024 * 1024);
but ng serve gives me :
Property 'openDatabase' does not exist on type 'Window'
I do not have any import specific to @types/websql. As it is not a module, I don't know how to import it.
Does anyone have any idea on how I can import this ?
Ok, I found the solution.
ng-cli generate a tsconfig.app.json with a property types set to [].
If I understand tsc doc correctly, it prevents the compiler to use the typeRoots property.
By simply removing this property, my code compile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With