m4heshd / better-sqlite3-multiple-ciphers

better-sqlite3 with multiple-cipher encryption support 🔒
MIT License
140 stars 27 forks source link

Can you include a type definition file for the TypeScript language? #44

Closed ryusei-48 closed 1 year ago

ryusei-48 commented 1 year ago

I am currently developing a desktop app in Electron. I am also finding it troublesome to set up VS Code and compile without errors. Thank you, I will try to find a way to make it work.

m4heshd commented 1 year ago

Hi @ryusei-48,

I'm not a TypeScript user but I assumed that #32 already fixed this. Is that not the case? 🤔

ryusei-48 commented 1 year ago

Thank you for your answer in your busy schedule. The type definition file for "better-sqlitet" was published here, so I overwrote this "index.d.ts" for "better-sqlite3-multiple-ciphers" and incorporated it into the package. After doing so, the type information was loaded without any problems. As a matter of fact, since the API is the same for both, there was no problem in using them interchangeably.

If this is the case, please release the next update including this "index.d.ts" and your problem will be solved.

Below is the overwritten "index.d.ts" file.

https://gist.github.com/ryusei-48/9ecb02d3c7a8d0af55fa56adb9db5a0e

Thank you very much.

m4heshd commented 1 year ago

The type definition file for "better-sqlitet" was published here

That, I'm aware of and in fact, @types/better-sqlite3 should've been sufficient since it's specified in the metadata. I've even tested this. Everything was picked up properly. It's quite odd it has suddenly become an issue.

As a matter of fact, since the API is the same for both, there was no problem in using them interchangeably.

That's not entirely true since some different, exclusive functionality has been added to bs3mc recently. Either way, I'll take a look at it as soon as I've got some time on my hands.

joyexpr commented 1 year ago

any progress ?

m4heshd commented 1 year ago

@ryusei-48, @joyexpr Can you try the dev branch and see if the type definitions work?

npm install https://github.com/m4heshd/better-sqlite3-multiple-ciphers/tarball/dev

From what I can test on my IDE, it works.

image

Kloen commented 1 year ago

It does work for me so far: image

m4heshd commented 1 year ago

@Kloen That would do it. Thanks.

The feature is now merged and available in v8.5.1-beta.0.

Kloen commented 1 year ago

@m4heshd worth mention that after switching to v8.5.1-beta.0 image

While using the dev branch: image

m4heshd commented 1 year ago

@Kloen Thank you for reporting. I forgot to include the definitions file in the published package on NPM. 🤦🏽

image

m4heshd commented 1 year ago

@Kloen Can you test v8.5.1-beta.1?

Kloen commented 1 year ago

@m4heshd looks like it did the trick now: image