Skip to content

Conversation

ndp
Copy link

@ndp ndp commented Nov 28, 2022

Here is an initial Typescript version of this where the tests pass and it has minimal types.

It's ready for initial review, but I want to try it in my project before considering it a merge candidate.

I initially tried to add a separate types file to be less disruptive, but it was more tedious and would be much harder to maintain. It was hard to make it hold together as a project. With this PR, I was able to fit the types into the existing .js file pretty seamlessly, so that you can actually read the code and tests and see that nothing has changed.

I imagine there's a much nicer Typescript version that has many fewer any and any[] types. For example, the query methods should be able to return a promise of a correctly typed object, if given a type. This, however, would be a little disruptive to the existing JS code, so I resisted the urge. I may pursue this as a second PR, but I need to get back to my main project.

{
"name": "sqlite-async",
"version": "1.1.5",
"version": "1.2.0",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you want here... It could be 1.1.6 as it is compatible.

bind(...args: any[]) {
return new Promise((resolve, reject) => {
let callback = (err) => {
const callback = (err: Error|null) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched to const on lines that were changed because of types. Not strictly necessary.

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

Successfully merging this pull request may close these issues.

1 participant