Closed raphael10-collab closed 2 years ago
Is there any
@types/better-sqlite3-multiple-ciphers
?
Unfortunately I haven't had the time to do a PR for that. I'd love some help with this. Since the API is completely identical to better-sqlite3
, all somebody will have to do is create a fork of @types/better-sqlite3
, rename it to better-sqlite3-multiple-ciphers
and just deal with the PR process of DefinitelyTyped.
@m4heshd I discovered that require('better-sqlite3-multiple-ciphers')(infopiecesDbpath, { verbose: console.log })
doesn't anymore complain about any missing declaration file for 'any' type
In the meanwhile I get this other error: SqliteError: file is not a database
:
https://github.com/m4heshd/better-sqlite3-multiple-ciphers/issues/23
Since the API is identical you don't even have to go to the trouble of copying the types. You can just add @types/better-sqlite3
as a devDependency and then add a types file like this:
declare module 'better-sqlite3-multiple-ciphers' {
import { BetterSqlite3 } from 'better-sqlite3';
export default BetterSqlite3.DatabaseConstructor;
}
You also don't have to deal with the PR process of DefinitelyTyped, you can include the types in your own repo and publish them along with the library (which is the preferred method anyway, since you don't have to install a separate types library).
(Edit to clarify): Anybody using this library and wishing they had types can use the snippet above in a *.d.ts
file to get them. To add types to this repo all you need is something like "types": "index.d.ts"
in package.json
, adding @types/better-sqlite3
to devDependencies
, and then put this into index.d.ts
:
import BetterSqlite3 from 'better-sqlite3';
export = BetterSqlite3;
import Database from 'better-sqlite3-multiple-ciphers'
:I added in
src/type/type.d.ts
:but still get the same error.
Is there any
@types/better-sqlite3-multiple-ciphers
?