Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript Definition File? #182

Open
MartinWebDev opened this issue Jul 12, 2017 · 13 comments
Open

Typescript Definition File? #182

MartinWebDev opened this issue Jul 12, 2017 · 13 comments

Comments

@MartinWebDev
Copy link

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 :)

@andpor
Copy link
Owner

andpor commented Jul 13, 2017

No Typescript Definition File yet I am afraid.

@dryganets
Copy link
Contributor

hmm, I guess I have one somewhere.
Will try to take a time to find it and add :)

@rodrigoelp
Copy link

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?

@rodrigoelp
Copy link

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 :(

@andpor
Copy link
Owner

andpor commented Dec 19, 2017

@rodrigoelp PR for TypeScript would be welcome. I don't know where to start either but hope you can figure it out.

@rodrigoelp
Copy link

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?

@andpor
Copy link
Owner

andpor commented Dec 19, 2017

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.

@brodycj
Copy link

brodycj commented Dec 19, 2017

Guys it looks like @matrosov-nikita contributed a nice set of typings for DefinitelyTyped in storesafe/cordova-sqlite-storage#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 storesafe/cordova-sqlite-storage#657 I would appreciate a PR for discussion on https://github.com/litehelpers/Cordova-sqlite-storage.

@dryganets
Copy link
Contributor

#220

This might be not ideal but should unblock you.

@rodrigoelp
Copy link

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

@rodrigoelp
Copy link

@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.

@jonmountjoy
Copy link

@types/react-native-sqlite-storage now exists, so I think this can be closed @andpor

@dryganets
Copy link
Contributor

yep @jonmountjoy, I ended up making the PR to the DT, it was faster to merge.
Sorry, should have mentioned that in this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants