diff --git a/src/index.ts b/src/index.ts index cadaea6..02963b9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,9 +6,9 @@ declare module "grammy" { handlePseudoUpdate(args: PseudoUpdateArg): Promise } interface Composer { - pseudo( - handler: MiddlewareFn - ): Composer + pseudo>( + handler: MiddlewareFn + ): Composer } interface Context extends PseudoUpdateFlavor {} } @@ -66,9 +66,10 @@ Bot.prototype.handlePseudoUpdate = async function ( }) } -Composer.prototype.pseudo = function ( - this: Composer, - handler: MiddlewareFn +// FIXME: replace `any` with C/C2 from the interface declaration +Composer.prototype.pseudo = function ( + this: Composer, + handler: MiddlewareFn ) { return this.use((ctx, next) => ctx.update.pseudo ? handler(ctx, next) : next()