ChatTypeContext
Type of the context object that is available inside the handlers for bot
.
This helper type can be used to narrow down context objects the same way how bot
does it. This allows you to annotate context objects in middleware that is not directly passed to bot
, hence not inferring the correct type automatically. That way, handlers can be defined in separate files and still have the correct types.
Type Parameters
C
ts
C extends Context
T
ts
T extends Chat["type"]
Type
ts
T extends unknown ? C & ChatTypeContextCore<T> : never