@yaebal/types

full Telegram Bot API types, code-generated from the ark0f machine-readable schema. the single source of truth for every interface in the yaebal ecosystem — @yaebal/contexts and @yaebal/core both read from it.

what it exports

exportkinddescription
object interfacesinterfaceone TypeScript interface per Bot API object — Message, User, Chat, PhotoSize, InlineKeyboardMarkup, etc.
*Params interfacesinterfaceone interface per Bot API method's parameters — SendMessageParams, SendPhotoParams, AnswerCallbackQueryParams, etc. required fields are non-optional; optional fields carry ?.
BotApiMethodsinterfaceevery Bot API method as a typed function signature: sendMessage(params: SendMessageParams): Promise<Message> and so on.
BOT_API_VERSIONstringthe Bot API version the current file was generated from, e.g. "8.3".

importing types

types.ts
import type {
  Message,
  User,
  Chat,
  PhotoSize,
  SendMessageParams,
  SendPhotoParams,
  BotApiMethods,
  BOT_API_VERSION,
} from "@yaebal/types";

BOT_API_VERSION

version.ts
import { BOT_API_VERSION } from "@yaebal/types";
console.log(BOT_API_VERSION); // e.g. "8.3"

BotApiMethods and *Params interfaces

methods.ts
import type { BotApiMethods, SendMessageParams } from "@yaebal/types";

// BotApiMethods is an interface with every Bot API method fully typed
type SendMessage = BotApiMethods["sendMessage"];
// (params: SendMessageParams) => Promise<Message>

// *Params interfaces carry every field the method accepts
const params: SendMessageParams = {
  chat_id: 123456,
  text: "hello",
  parse_mode: "HTML", // optional fields are typed too
};

file structure

src/telegram.ts is the sole generated file. it is committed to the repository as the authoritative snapshot. do not edit it by hand — any manual edit will be overwritten on the next generation run.

src/telegram.ts (excerpt)
// AUTO-GENERATED from the Telegram Bot API schema — do not edit by hand.
// Regenerate with: pnpm --filter @yaebal/types generate
// Source: https://ark0f.github.io/tg-bot-api/

export const BOT_API_VERSION = "8.3";

export interface AffiliateInfo { /* … */ }
export interface Animation { /* … */ }
// … all Bot API objects …
export interface SendMessageParams { /* … */ }
// … all *Params interfaces …
export interface BotApiMethods {
  sendMessage(params: SendMessageParams): Promise<Message>;
  // … every method …
}

regenerating

the generator script (scripts/generate.mjs) reads schema.json (the ark0f schema snapshot checked into the repo) and rewrites src/telegram.ts. update schema.json to the latest version from ark0f.github.io/tg-bot-api, then run:

terminal
# refresh schema.json from ark0f's machine-readable Bot API schema, then:
pnpm --filter @yaebal/types generate

relationship to other packages

packagehow it uses @yaebal/types
@yaebal/coreimports object interfaces for context fields (Message, User, Chat, …)
@yaebal/contextscode-generates per-update shortcut methods from BotApiMethods and the *Params interfaces
@yaebal/types has zero runtime dependencies — it is types-only. import with import type in application code so the import is erased at build time and never appears in the output bundle.