-
Notifications
You must be signed in to change notification settings - Fork 7
Definition State #3
Comments
Hello Blake! This was initially automatically generated from the file that the RethinkDB docs. The ugly, rudimentary generator is in the repo. In the end I've analyzed all the internal types of RethinkDB, matched up the common and differing implementations of various methods in the various types and rewrote the typings by hand, partially copy & pasting the autogenerated ones. Unfortunately even that has proven to be really hard, as there are many features in the API of RethinkDB that TypeScript just does not yet support. Those features would make this endeavor much simpler, and in the case of some - at all possible:
Then there are also some things like RethinkDB's varar arity that will never be supported (microsoft/TypeScript#6755) and require hacks. See this issue for more details see this and the following comment: DefinitelyTyped/DefinitelyTyped#4551 (comment). I've put this project on hold pending at least microsoft/TypeScript#1295 implementation that will make this much more useful. The typings in this repo are useful as they are, but not 100% complete. Coming with TypeScript 2.0 there's now a nice workaround for Type's generic type constraint on member level microsoft/TypeScript#1290 (comment) which would maybe make it possible to implement We also need more tests, since the ones available are only using the simplest examples. Using the typings in practice, I've stumbled upon many cases which required me to cast parts of the RethinkDB call to The typings are relatively well organized, and if you use a code editor with folding support you can easily see which interface implements which methods in what way. If you want to help out with this effort I'm happy to add you as a collaborator. |
The current input file for the old generator can be found here.
Regarding your question:
The answer is yes - in fact that was the aim of DefinitelyTyped/DefinitelyTyped#4551 all along. We didn't publish the typings to DefinitelyTyped (me and @ronzeidman), because of the unresolved issues that are still present. |
Thanks for the detailed answer. I'm not too worried about the shortcomings, we can eventually improve those. The biggest issue I run into when trying these were actually incorrect types - the obvious ones were around document manipulation and |
Do you have a specific piece of code where you cannot run Would you mind sharing your definitions in their current, incomplete state? I'm curious how you solved certain problems like the varar arity, group/ungroup, type-loss in chains, etc. |
Mostly I've run into document manipulation issues with the |
@niieani This is what I've ended up on. I ended up tossing away my definition and using yours. I refactored it continuously for the last day (or two) until I had gone over all the methods. Toward the end, I realised I needed to delete the abstract Edit: I also removed a couple of other types, and haven't come back to visit the |
OK, that's interesting. |
@niieani Sorry, I thought I put the link in there 😄 It's http://github.com/types/npm-rethinkdb. Both |
I also discovered that there's native result, |
Looks good. |
@niieani Awesome, cheers! Definitely log plenty of issues. We can move any discussions there and happy to log lots of issues for everything encountered. The biggest issue (or non-issue) I've been facing is using the definition on 2.0 with |
@niieani By the way, the script I was hoping for was
|
Since |
Ah, thanks! I somehow didn't realise it was part of the RethinkDB org, cheers! Yeah, you're right about |
Any updates on those fixes? :P Or any idea how to use the lib in typescript without that? |
This repo has been deprecated by https://github.com/types/rethinkdb. Please see that for up-to-date typings instead. |
So I spent the day typing this by hand and am currently around 1000 lines and a third of the definition through. However, much of it is likely incorrect in some way and will need refactoring anyway. Then I run across this and it looks fairly complete and would like to learn more.
Is/was it all automatically generated? What do you think the main issues are? Any reason for
noImplicitAny
failures? Would you want to collaborate in @types on the definition? Can the original script/scraper be shared?The text was updated successfully, but these errors were encountered: