mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 15:34:38 +03:00
22 lines
618 B
TypeScript
22 lines
618 B
TypeScript
import { Composer, Middleware, Telegraf } from 'telegraf';
|
|
|
|
export type Filter<T extends any[], F> = T extends []
|
|
? []
|
|
: T extends [infer Head, ...infer Tail]
|
|
? Head extends F
|
|
? Filter<Tail, F>
|
|
: [Head, ...Filter<Tail, F>]
|
|
: [];
|
|
|
|
export type UpdateMethods = Exclude<
|
|
keyof Composer<never>,
|
|
'middleware' | 'guard' | 'filter' | 'drop'
|
|
>;
|
|
export type UpdateMethodArgs<T extends UpdateMethods> = Filter<
|
|
Parameters<Composer<never>[T]>,
|
|
Middleware<any>
|
|
>;
|
|
|
|
export type TelegrafOption = ConstructorParameters<typeof Telegraf>[1];
|
|
export type TelegrafLaunchOption = Parameters<Telegraf['launch']>[0];
|