import { Composer, Middleware, Telegraf } from 'telegraf'; export type Filter = T extends [] ? [] : T extends [infer Head, ...infer Tail] ? Head extends F ? Filter : [Head, ...Filter] : []; export type UpdateMethods = Exclude< keyof Composer, 'middleware' | 'guard' | 'filter' | 'drop' >; export type UpdateMethodArgs = Filter< Parameters[T]>, Middleware >; // type Test0 = Filter<[['foo', 'bar', 'booz'], ...Middleware[]], Middleware>; // type Test1 = UpdateMethodArgs<'on'>; // type Test2 = Parameters['on']>; export type TelegrafOption = ConstructorParameters[1]; export type TelegrafLaunchOption = Parameters[0];