Skip to content

Type incompatibility with gramio v0.4.11 #2

@mirismaili

Description

@mirismaili

Unfortunately, the latest version of gramio (currently: v0.4.11) uses @gramio/callback-data@0.0.3 which is incompatible with the latest version of @gramio/callback-data (currently: v0.0.11). In the following example:

import { Bot } from "gramio" // v0.4.11
import {CallbackData} from "@gramio/callback-data" // v0.0.11, NOT v0.0.3

const someData = new CallbackData("example").number("id")

export const bot = new Bot(process.env.BOT_TOKEN!)
    .callbackQuery(someData, (context) => {
        context.queryData; // is type-safe
    })

Will raises type error on someData (which is passed to .callbackQuery()):

TS2345: Argument of type
CallbackData<{
    id: number;
}, {
    id: number;
}>
is not assignable to parameter of type
string | RegExp | CallbackData<Record<never, never>>
Type
CallbackData<{
    id: number;
}, {
    id: number;
}>
is not assignable to type CallbackData<Record<never, never>>
Property schema is protected in type
CallbackData<{
    id: number;
}, {
    id: number;
}>
but public in type CallbackData<Record<never, never>>

just for a little issue (protected vs public property schema)!


So I forced to override the version:

"overrides": {
  "@gramio/callback-data": "0.0.11"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions