You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue isn't about my code really. When I try to
npm run serve
my Firebase cloud functions, it fails at the
tsc build
with an internal type error (provided below).
Expected Behavior
I want the thing to compile and run.
Current Behavior
It fails to compile because of some internal type mismatch errors.
Error Message and Logs (export DEBUG='telegraf:*')
node_modules/telegraf/typings/composer.d.ts:39:129 - error TS2344: Type 'FilteredContext<C, Filter>' does not satisfy the constraint 'Context<Update>'.
Type 'NarrowedContext<C, Extract<MessageReactionUpdate, Record<Filter, object>> | Extract<MessageReactionCountUpdate, Record<...>> | ... 15 more ... | Extract<...>> | NarrowedContext<...>' is not assignable to type 'Context<Update>'.
Type 'NarrowedContext<C, Extract<MessageReactionUpdate, Record<Filter, object>> | Extract<MessageReactionCountUpdate, Record<...>> | ... 15 more ... | Extract<...>>' is not assignable to type 'Context<Update>'.
Types of property 'message' are incompatible.
Type 'PropOr<Extract<MessageReactionUpdate, Record<Filter, object>>, "message", undefined> | PropOr<Extract<MessageReactionCountUpdate, Record<...>>, "message", undefined> | ... 15 more ... | PropOr<...>' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'PropOr<Extract<MessageReactionUpdate, Record<Filter, object>>, "message", undefined>' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type '(Partial<Record<"message", unknown>> & Extract<MessageReactionUpdate, Record<Filter, object>>)["message"] | undefined' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'Extract<MessageReactionUpdate, Record<Filter, object>>["message"]' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'object' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'Extract<MessageReactionUpdate, Record<Filter, object>>["message"]' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'object' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'object' is not assignable to type 'NonChannel'.
Type 'Extract<MessageReactionUpdate, Record<Filter, object>>["message"]' is not assignable to type 'NonChannel'.
Type '{}' is missing the following properties from type 'NonChannel': chat, from
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type '(Partial<Record<"message", unknown>> & Record<Filter, object> & MessageReactionUpdate)["message"] | undefined' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'object' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'PropOr<Extract<MessageReactionUpdate, Record<Filter, object>>, "message", undefined>' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type '(Partial<Record<"message", unknown>> & Extract<MessageReactionUpdate, Record<Filter, object>>)["message"] | undefined' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'undefined' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type '(Partial<Record<"message", unknown>> & Record<Filter, object> & MessageReactionUpdate)["message"] | undefined' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'undefined' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type 'New'.
Type '(Partial<Record<"message", unknown>> & Record<Filter, object> & MessageReactionUpdate)["message"] | undefined' is not assignable to type 'New'.
Type 'undefined' is not assignable to type 'New'.
Type 'PropOr<Extract<MessageReactionUpdate, Record<Filter, object>>, "message", undefined>' is not assignable to type 'New'.
Type '(Partial<Record<"message", unknown>> & Extract<MessageReactionUpdate, Record<Filter, object>>)["message"] | undefined' is not assignable to type 'New'.
Type 'undefined' is not assignable to type 'New'.
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type 'New'.
Type '(Partial<Record<"message", unknown>> & Record<Filter, object> & MessageReactionUpdate)["message"] | undefined' is not assignable to type 'New'.
Type 'undefined' is not assignable to type 'New'.
Type 'NarrowedContext<C, MessageUpdate<Message>> | NarrowedContext<C, PollUpdate> | NarrowedContext<C, ChatMemberUpdate> | ... 15 more ... | NarrowedContext<...>' is not assignable to type 'Context<Update>'.
Type 'NarrowedContext<C, C["update"]>' is not assignable to type 'Context<Update>'.
Types of property 'msg' are incompatible.
Type 'GetMsg<C["update"]> & Msg' is not assignable to type '(MaybeInaccessibleMessage | (New & NonChannel & Message) | (New & Channel & Message) | (Edited & Channel & CommonMessageBundle) | (Edited & ... 1 more ... & CommonMessageBundle) | undefined) & Msg'.
Type 'GetMsg<C["update"]> & Msg' is not assignable to type 'Edited & NonChannel & VoiceMessage & Msg'.
Type 'GetMsg<C["update"]> & Msg' is not assignable to type 'Edited'.
39 on<Filter extends tt.UpdateType | Guard<C['update']>>(filters: MaybeArray<Filter>, ...fns: NonemptyReadonlyArray<Middleware<FilteredContext<C, Filter>>>): this;
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/telegraf/typings/composer.d.ts:152:159 - error TS2344: Type 'FilteredContext<Ctx, Filter>' does not satisfy the constraint 'Context<Update>'.
Type 'NarrowedContext<Ctx, Extract<MessageReactionUpdate, Record<Filter, object>> | Extract<MessageReactionCountUpdate, Record<...>> | ... 15 more ... | Extract<...>> | NarrowedContext<...>' is not assignable to type 'Context<Update>'.
Type 'NarrowedContext<Ctx, Extract<MessageReactionUpdate, Record<Filter, object>> | Extract<MessageReactionCountUpdate, Record<...>> | ... 15 more ... | Extract<...>>' is not assignable to type 'Context<Update>'.
Types of property 'message' are incompatible.
Type 'PropOr<Extract<MessageReactionUpdate, Record<Filter, object>>, "message", undefined> | PropOr<Extract<MessageReactionCountUpdate, Record<...>>, "message", undefined> | ... 15 more ... | PropOr<...>' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'PropOr<Extract<MessageReactionUpdate, Record<Filter, object>>, "message", undefined>' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type '(Partial<Record<"message", unknown>> & Extract<MessageReactionUpdate, Record<Filter, object>>)["message"] | undefined' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'Extract<MessageReactionUpdate, Record<Filter, object>>["message"]' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'object' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'Extract<MessageReactionUpdate, Record<Filter, object>>["message"]' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'object' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'Extract<MessageReactionUpdate, Record<Filter, object>>["message"]' is not assignable to type 'NonChannel'.
Type 'object' is not assignable to type 'NonChannel'.
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type '(Partial<Record<"message", unknown>> & Record<Filter, object> & MessageReactionUpdate)["message"] | undefined' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'object' is not assignable to type '(New & NonChannel & Message) | undefined'.
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'PropOr<Extract<MessageReactionUpdate, Record<Filter, object>>, "message", undefined>' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type '(Partial<Record<"message", unknown>> & Extract<MessageReactionUpdate, Record<Filter, object>>)["message"] | undefined' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'undefined' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type '(Partial<Record<"message", unknown>> & Record<Filter, object> & MessageReactionUpdate)["message"] | undefined' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'undefined' is not assignable to type 'New & NonChannel & VoiceMessage'.
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type 'New'.
Type '(Partial<Record<"message", unknown>> & Record<Filter, object> & MessageReactionUpdate)["message"] | undefined' is not assignable to type 'New'.
Type 'undefined' is not assignable to type 'New'.
Type 'PropOr<Extract<MessageReactionUpdate, Record<Filter, object>>, "message", undefined>' is not assignable to type 'New'.
Type '(Partial<Record<"message", unknown>> & Extract<MessageReactionUpdate, Record<Filter, object>>)["message"] | undefined' is not assignable to type 'New'.
Type 'undefined' is not assignable to type 'New'.
Type 'PropOr<Record<Filter, object> & MessageReactionUpdate, "message", undefined>' is not assignable to type 'New'.
Type '(Partial<Record<"message", unknown>> & Record<Filter, object> & MessageReactionUpdate)["message"] | undefined' is not assignable to type 'New'.
Type 'undefined' is not assignable to type 'New'.
Type 'NarrowedContext<Ctx, MessageUpdate<Message>> | NarrowedContext<Ctx, PollUpdate> | NarrowedContext<...> | ... 15 more ... | NarrowedContext<...>' is not assignable to type 'Context<Update>'.
Type 'NarrowedContext<Ctx, Ctx["update"]>' is not assignable to type 'Context<Update>'.
Types of property 'msg' are incompatible.
Type 'GetMsg<Ctx["update"]> & Msg' is not assignable to type '(MaybeInaccessibleMessage | (New & NonChannel & Message) | (New & Channel & Message) | (Edited & Channel & CommonMessageBundle) | (Edited & ... 1 more ... & CommonMessageBundle) | undefined) & Msg'.
Type 'GetMsg<Ctx["update"]> & Msg' is not assignable to type 'Edited & NonChannel & VoiceMessage & Msg'.
Type 'GetMsg<Ctx["update"]> & Msg' is not assignable to type 'Edited'.
152 static on<Ctx extends Context, Filter extends tt.UpdateType | Guard<Ctx['update']>>(filters: MaybeArray<Filter>, ...fns: NonemptyReadonlyArray<Middleware<FilteredContext<Ctx, Filter>>>): MiddlewareFn<Ctx>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The text was updated successfully, but these errors were encountered:
TypeScript version? Regardless, it's better to enable skipLibCheck: true in your tsconfig.json. It's recommended, and is the default setting if you did tsc init
TypeScript version? Regardless, it's better to enable skipLibCheck: true in your tsconfig.json. It's recommended, and is the default setting if you did tsc init
Context
I am using Telegraf in a firebase cloud function with roughly the following setup:
Minimal Example Code Reproducing the Issue
The issue isn't about my code really. When I try to
my Firebase cloud functions, it fails at the
with an internal type error (provided below).
Expected Behavior
I want the thing to compile and run.
Current Behavior
It fails to compile because of some internal type mismatch errors.
Error Message and Logs (
export DEBUG='telegraf:*'
)The text was updated successfully, but these errors were encountered: