-
Notifications
You must be signed in to change notification settings - Fork 354
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 Typings #65
Comments
This is definitely interesting to us! Let's land your other diff first before we address this one. Does TypeScript 2.0 have an official stable date? |
Nope, but a release candidate is out and only a few issues remain marked for the 2.0 release. I'd guess within a month, given their track record. |
I've updated the SDK with the new JSDoc typing information. We can get started on this now :) |
Once I update the generator to handle struct polymorphism, I'll open up a PR. |
btw, I'm throwing some of the example code at the TypeScript typings to test them out, and I'm noticing that the examples omit some argument fields that are not marked as nullable in the stone typings. For example, the |
Nevermind! I just noticed the default values. |
PR now open on stone! 😄 When that's merged in, I can open a PR on dropbox-sdk-js from my fork. |
It's very nice to see that you guys are already things about supporting TypeScript typings. When you have something in, I'm definitely going check it out! |
@kenjiru it's completed; I'm just waiting for Dropbox to review the code. :) Feel free to check out my open PR for TypeScript definition files for stone for details. |
Yes, sorry, I was on PTO for 2 weeks. I'll be reviewing this soon. |
@braincore @jvilk Is this still in progress? I've been holding off porting my project to the new dropbox API until it has TypeScript support. |
@plemarquand Yeah, same here. I'm waiting on a code review. It's basically complete, pending any adjustments they ask me to make. |
@plemarquand Don't hold of, just add a declaration for the module. Starting with TypeScript 2.0, you can do this You lose all the typing information, so you will need to rely on unit tests. But at least you can use the new package, and you can drop the stub when the typings will become available. |
Stone PR is merged in! I can now open a PR for this. |
PR opened! |
Hello, is there any plan to publish the typings on the DefinitelyTyped repository? so we will be able to install them like @types/dropbox ? |
@denkomanceski I'm not affiliated with Dropbox, but the typings should be present in the next version of the |
@denkomanceski I'll be making a release on Monday, and you should be able to grab the typings from the dropbox package itself. |
Does this has been published? |
No; the last published release was 2 months ago, before the TypeScript types were merged into |
@jrmgx published! sorry about the trouble, let me know how it works out. |
works like a charm, thx :) |
I'm opening up this issue to start a dialog. Would you be open to generating TypeScript typings for your library, and including them in the NPM package?
Overview
I wrote a TypeScript definition generator for Stone that can automatically generate a TypeScript definition file for a JavaScript client. Stone types neatly map onto TypeScript interfaces. All the generator needs is a template to "fill in" with routes and types.
Here's the template I wrote for this SDK, which contains manual typings for the portions of your SDK that are not generated by Stone:
(Note: There's no
DropboxTeam
/DropboxBase
classes, since all of those JSDoc types stem from the same constructor. TypeScript has no way to disambiguate the two.)Here's a link to the generated typings. TypeScript's type system is insufficiently expressive to support typing
Promise
error types, so the TSDoc for each route mentions the error type in the text.Maintenance
--extra-args
also need to be specified using TypeScript typings and passed to the generator. In most cases, the JSDoc type aligns with the TypeScript type, so no change is needed across generators.Benefits
I believe the benefits massively outweigh the maintenance burden, but if this is not something you are interested in, I will just upload the final definition file to DefinitelyTyped.
The text was updated successfully, but these errors were encountered: