mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-27 08:18:08 +03:00
663ebf1a62
* 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
22 lines
689 B
TypeScript
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];
|