grammyjs / menu

Interactive menus for grammY.
https://grammy.dev/plugins/menu
MIT License
31 stars 11 forks source link

typescript error TS2307 Cannot find module 'grammy/out/composer.js' #49

Open zivni opened 2 months ago

zivni commented 2 months ago

I'm getting the following error:

**node_modules/@grammyjs/menu/out/menu.d.ts:601:26 - error TS2307: Cannot find module 'grammy/out/composer.js' or its corresponding type declarations.

601     middleware(): import("grammy/out/composer.js").MiddlewareFn<C>;
                             ~~~~~~~~~~~~~~~~~~~~~~~~**

The fix seems to be adding type MiddlewareFn to the import from "./deps.node.js", and removing the import frim line 601

@grammyjs/conversations it works OK.

KnorpelSenf commented 2 months ago

You should not modify the content in node_modules. Which versions of the plugin and the core lib are installed? Can you npm ls them?

Also, consider enabling skipLibCheck in your TS config.

zivni commented 2 months ago

I know I shouldn't just was checking to see what's wrong.

I'm using yarn and installed the latest of both:

grammy 1.29.0 @grammyjs/conversations 1.2.0 @grammyjs/menu 1.2.2 @grammyjs/types 3.13.0

KnorpelSenf commented 2 months ago

Interesting, I'll try to reproduce this in a few days and see if it can be fixed by changing anything in the plugin. Until then, you can use skipLibCheck.

Naturally, if you feel like fixing it yourself in the code, please go ahead and open a pull request.