Typescript implementation #19
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
andany[]
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.