grammyjs / grammY

The Telegram Bot Framework.
https://grammy.dev
MIT License
2.36k stars 116 forks source link

1.22.0 broke existing code type check #562

Closed EdJoPaTo closed 6 months ago

EdJoPaTo commented 6 months ago

Existing code stopped working with 1.22.0, to be exact #553.

bot.on(
    'edited_message',
    async ctx =>
        ctx.reply(
            'Edited!',
            {reply_to_message_id: ctx.editedMessage.message_id},
        ),
);
error TS18048: 'ctx.editedMessage' is possibly 'undefined'.

This looks like a mistake and should be fixed.

AB-70 commented 6 months ago

Facing the same issue after updating. Getting so many errors in my project because of type errors.

KnorpelSenf commented 6 months ago

I am waiting for a review of #555.

KnorpelSenf commented 6 months ago

555 was merged and fixed this

EdJoPaTo commented 6 months ago

Nope. npm it grammyjs/grammy#main'ctx.editedMessage' is possibly 'undefined'

Edit: same with npm it grammy@1.23

For someone wanting to look into it:

https://github.com/HAWHHCalendarBot/TelegramBot/blob/869cc0518443fe59f5334e62e61fa782678b0e45/source/parts/easter-eggs.ts#L6-L13

KnorpelSenf commented 6 months ago

Fascinating, investigating

KnorpelSenf commented 6 months ago

@EdJoPaTo please check out #578

EdJoPaTo commented 6 months ago

npm it grammyjs/grammy#main works now :sparkles: