-
Notifications
You must be signed in to change notification settings - Fork 38
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 support #32
Comments
Sounds like a good idea. Seems like I'll have to publish a -typed version of Slimbot in order not to break existing projects. I've also done some cursory research into maintaining this with Lerna, and it should be pretty straightforward. |
Shouldn't it be sufficient to publish the types to DefinitelyTyped? I do not see how this would break existing projects. (Maybe that's because I am not too experienced with typescript yet.) |
I'm beginning to look into TypeScript migration as it's becoming more necessary to manage method arguments safely, and will intend to publish an alpha for testing when it's ready. |
Do you want to have the benefits of TypeScript available for your development of slimbot? Because if it's only about providing types to your users, consider writing a declaration file instead. This does not affect users of your library at all that do not want to use TS because the types can be published as a separate package that is linked to slimbot. |
Yeah, for my own development, particularly when I'm doing manual testing for a method like createNewStickerSet where the Your suggestion to write a declaration file is great though, it'll make for a safer upgrade for existing lib users. Thank you so much for your suggestion. I'll give this a go first before diving into migrating the entire project into TS. |
@edisonchee I published TypeScript declaration files for the complete Telegram API in the npm package This will probably even prevent you from having to migrate all the code to TS. Adding a few type signatures for your own methods and otherwise pulling in the existing types for the Telegram API should give you and your users 100 % coverage without much hassle. |
There does not seem to be any progress on this issue. Moreover, there does not really seem to exist any other Node.js library that has good TypeScript support. Hence, I decided to create a new library a few months ago that is written from the ground up in TypeScript. It is much smaller than slimbot and still a lot more powerful: https://github.com/grammyjs/grammY I do not need TypeScript support for slimbot anymore. However, I'll keep this issue open for reference. Size comparison: |
Title says it all.
Maybe node-telegram-bot-api's types can be used as a template. Then it is not needed to model the whole Telegram API again (just the methods specific to slimbot).
The text was updated successfully, but these errors were encountered: