Closed EdJoPaTo closed 4 years ago
Currently I often use (ctx: any) as something likectx.session or ctx.match is missing and then gets highlighted by the TypeScript compiler.
(ctx: any)
ctx.session
ctx.match
I thought about adding a generic to the class itself so it would look like this:
const menu = new TelegrafInlineMenu<MyContextType>(ctx => `Hey ${ctx.from.first_name}!`) menu.simpleButton('I am excited!', 'a', { doFunc: ctx => ctx.reply(ctx.session.something) })
But I am not sure what the best way would be here. Any ideas anyone?
(ctx.match should be added to the Telegraf typings itself, something like ctx.session should not, as its a user variable)
This is included in the upcoming version 5
Currently I often use
(ctx: any)
as something likectx.session
orctx.match
is missing and then gets highlighted by the TypeScript compiler.I thought about adding a generic to the class itself so it would look like this:
But I am not sure what the best way would be here. Any ideas anyone?
(
ctx.match
should be added to the Telegraf typings itself, something likectx.session
should not, as its a user variable)