Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some Update sub-types generic #10

Closed
wants to merge 1 commit into from
Closed

Make some Update sub-types generic #10

wants to merge 1 commit into from

Conversation

wojpawlik
Copy link
Collaborator

@wojpawlik wojpawlik commented Nov 4, 2020

To allow types like Context<MessageUpdate<TextMessage>> in the future; Telegraf can't use this right now due to microsoft/TypeScript#4742, so don't bother releasing just this on npm.

@KnorpelSenf
Copy link
Owner

This is rather on the side of useful helper types, it does not directly reflect the Telegram API. I am not sure if this is in scope of typegram or if it should rather be implemented by dependent libraries, e.g. like this:

type Upd<M extends Message> = Update.MessageUpdate & { message: M }

I will keep this open until we have a concrete use-case for it, maybe then it is clearer whether this is the right place to implement your idea.

@wojpawlik
Copy link
Collaborator Author

wojpawlik commented Nov 7, 2020

Use case: ctx in bot.on('text', ctx => { ... }) should be Context<MessageUpdate<TextMessage>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants