gramjs
gramjs copied to clipboard
addEventHandler allows 1 parameter but removeEventHandler requires 2
According to TypeScript it's possible to use addEventHandler with 1 parameter but it's not clear how to unsubscribe from it then:
this.telegramClient.addEventHandler(this.onUnknownEvent);
this.telegramClient.removeEventHandler(this.onUnknownEvent); // TS error - 2 arguments are expected
https://github.com/gram-js/gramjs/blob/2e8eff33c783dfd86a3fab98ab684637e33149cc/gramjs/client/TelegramClient.ts#L1111-L1123
I see that addEventHandler eventually fallbacks to new Raw({}):
https://github.com/gram-js/gramjs/blob/2e8eff33c783dfd86a3fab98ab684637e33149cc/gramjs/client/updates.ts#L47
Can create a PR that either fixes addEventHandler typings (simpler but BC break) or marks removeEventHandler's second argument optional and loads the Raw class