grammyjs / emoji

Helpers for sending emojis.
https://grammy.dev/plugins/emoji
MIT License
9 stars 2 forks source link

Context flavour does not respect adjusted return types of `ctx.reply` #8

Closed KnorpelSenf closed 2 years ago

KnorpelSenf commented 2 years ago

Feature request

If I adjust the return type of ctx.reply using a different plugin, such as the hydrate plugin, I would like the type of ctx.replyWithEmoji to adjust accordingly. This makes it necessary to use a transformative context flavour, rather than an additive one.

KnorpelSenf commented 2 years ago

This might not be possible because TS does not allow to further transform function signatures which have been created by transformative context flavours, i.e. via intersection.

KnightNiwrem commented 2 years ago

It's technically doable. The recently released parse-mode is capable of working with hydrate with the sole exception of replyWithFmt. On the other hand, if I wanted replyWithFmt to have some success at the expense of the other functions, I could swap the order of intersection elements in HydrateFlavor. Further details are at https://github.com/grammyjs/emoji/pull/9#issuecomment-1083364176.

It's.. not a great solution. Perhaps there is a way to modify the function signatures for hydrate without intersections? I would not imagine that, function overloads of untransformed Context's reply and transformed Context's reply, was what hydrate was exactly going for.

KnorpelSenf commented 2 years ago

Could you support #9 be on par with parse-mode?