nestjs-telegraf/lib/types/index.ts
Morbo 663ebf1a62
Update to Telegraf v4.0.0 (#212)
* feat(telegraf): update to v4.0.0

* chore(lock): update package-lock

* chore(deps): remove telegraf from dependencies

* chore(readme): update installation command

* chore(deps): add telegraf to dev dependencies
2021-01-11 16:17:32 +03:00

22 lines
689 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 OnlyFunctionPropertyNames<T> = {
[K in keyof T]: T[K] extends (...args: any) => any ? K : never;
}[keyof T];
export type ComposerMethodArgs<
T extends Composer<never>,
U extends OnlyFunctionPropertyNames<T> = OnlyFunctionPropertyNames<T>
> = Filter<Parameters<T[U]>, Middleware<never>>;
export type LaunchOptions = Parameters<Telegraf['launch']>[0];
export type TelegrafOptions = ConstructorParameters<typeof Telegraf>[1];