JSPM

  • Created
  • Published
  • Downloads 9057
  • Score
    100M100P100Q120858F
  • License ISC

Type declarations for the Telegram API

Package Exports

  • typegram

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (typegram) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Types for the Telegram API

This project provides TypeScript types for the entire Telegram API in version 4.9 which was released on June 4, 2020.

Good to know

  • Generally this package just exposes a huge load of interfaces as well as a single class Telegram which contains all available methods of the API. There is no further structure applied to this, but if you can come up with something reasonable, please suggest it in an issue or directly open a PR.

  • All of the methods are specified with the actual return type of the Telegram API. If you need them to return Promises instead, consider using TelegramP. This type maps all methods of Telegram to a promisified version.

  • Each method takes just a single argument with a structure that corresponds to the object expected by Telegram. If you need to directly access that type, consider using Opts<M> where M is the method name (e.g. Opts<'getMe'>).

Where do the types come from

They're handwritten.

That is, they're of course not entirely handwritten. The initial version of them were produced in one afternoon by a combination of copying and pasting from the website, VIM magic, regular expressions and VSCode auto-formatting the rest.

Previous attempts to harvest them directly from the website in an automated fashion failed due to the required effort of handling special cases.

Future updates to the API will be integrated manually in a similar fashion.