I have found the error:
This Types module is probably required for use in typescript:
https://www.npmjs.com/package/@types/better-sqlite3
If you install this module and do the import via import * as Database from 'better-sqlite3'
, then everything works as desired (almost).
The important thing is that the compiler gives you an error for the iteratiion for example:
Type 'IterableIterator<unknown>' can only be iterated through
when using the '--downlevelIteration' flag or
with a '--target' of 'es2015' or higher.
8 for(const row of stmt.iterate()) {
You should therefore set the target to “target”: “es2015”,
in the compiler options, if you want to use this Feature.