react-native-sqlite-storage
react-native-sqlite-storage copied to clipboard
Typescript Definition File?
Hi, sorry to bother you, and I know this isn't an "issue" as such. But is there a Typescript Definition file I can download somewhere for this package? I am trying to write my own as I go and just add whatever functions and return types I need as I find them, but I've not got much experience in writing d.ts files so if someone already has one I would really appreciate a copy.
Perhaps one could be added into the repo?
Thanks :)
No Typescript Definition File yet I am afraid.
hmm, I guess I have one somewhere. Will try to take a time to find it and add :)
Hey @dryganets, quite a few months ago you mentioned about a type definition file for this, but is not available (or I can't find it)
Is it going to be produced?
By the way, it would be great to get the type definition file. I have created a couple of other projects and I've started to read your tests (index.ios.promise.js) and I honestly don't know where to start with your code :(
@rodrigoelp PR for TypeScript would be welcome. I don't know where to start either but hope you can figure it out.
Hi @andpor, I've started to look into it and have created the basic shape of the react-native-sqlite-storage module. I do need to check with you a few function names as I have been following your tests to create the definition.
The plugin as such as: DEBUG, enablePromise, openDatabase and deleteDatabase, right?
Then the database as such should be: executeSql, transaction and close.
All these definitions have a callback and promise flavour.
Am I missing something else?
these are the functions of the database - you need an instance
[false,"SQLitePlugin","transaction",false,true,true], [false,"SQLitePlugin","readTransaction",false,true,true], [false,"SQLitePlugin","close",false,false,true], [false,"SQLitePlugin","executeSql",true,false,true], [false,"SQLitePlugin","sqlBatch",false,false,true], [false,"SQLitePlugin","attach",true,false,true], [false,"SQLitePlugin","detach",false,false,true], [false,"SQLitePluginTransaction","executeSql",true,false,false],
These are database factory methods: [false,"SQLiteFactory","deleteDatabase",false,false,true], [true, "SQLiteFactory","openDatabase",false,false,true], [false,"SQLiteFactory","echoTest",false,false,true]
Depending on the interface choice these work in a callback or promise fashion.
DEBUG and enablePromise are utility functions that related to the module rather than the db itsef.
Guys it looks like @matrosov-nikita contributed a nice set of typings for DefinitelyTyped in https://github.com/litehelpers/Cordova-sqlite-storage/pull/657 and I am thinking to integrate into the cordova-sqlite-storage plugin project that this project was based on. It may be ideal to share the typings between the different sqlite plugin versions as much as possible.
If you would like to see something different from the typings proposed in https://github.com/litehelpers/Cordova-sqlite-storage/pull/657 I would appreciate a PR for discussion on https://github.com/litehelpers/Cordova-sqlite-storage.
https://github.com/andpor/react-native-sqlite-storage/pull/220
This might be not ideal but should unblock you.
Ok, I've created a pull request with the signatures to match the SQLiteFactory (which I called SQLitePlugin) and the SQLitePlugin (which I called Database)
I will gladly receive comments from any of you about this as part of the review process.
The pull request is: #221
@dryganets just noticed you had created an earlier pull request with your own definitions. I guess @andpor will be happy to pick one of the two and discard the other one.
@types/react-native-sqlite-storage now exists, so I think this can be closed @andpor
yep @jonmountjoy, I ended up making the PR to the DT, it was faster to merge. Sorry, should have mentioned that in this thread.