telegraf-session-local
telegraf-session-local copied to clipboard
Problem with types
Hey, just install package and got types error:
node_modules/telegraf-session-local/lib/session.d.ts:34:3 - error TS2309: An export assignment cannot be used in a module with other exported elements.
34 export = LocalSession
~~~~~~~~~~~~~~~~~~~~~
Seems it because also interface exported. I think change export = LocalSession to export default LocalSession can fix this.
Now I can't really use this package.
I use this as it is in multiple bots. Check for example my template which also works.
Typings are not ideal but they work good enough for me. The only thing that would really improve types in my opinion would be a (breaking) refactoring into native typescript. Then types are exactly the same as the underlying JavaScript.
I tried the import like you, but still the same problem I use the latest version which is 2.1.0 and my telegraf version is 4.0.3.
If you have esModuleInterop enabled (in tsconfig.json) you might need an import without * as. Personally I try to avoid esModuleInterop as it also works without (as long as the modules I use dont have it).
Yes, I do the same. I have already tried with both enabled and disabled esModuleInterop, but this is an error in the export types, WebStorm highlight this.
Hey! How to solve this problem?
An export assignment cannot be used in a module with other exported elements.
34 export = LocalSession
Still having this issue too! not typescript compatible
Using "skipLibCheck": true in tsconfig.json fixed this for me
As people check this issue I will suggest it here again: I strongly suggest using grammY over Telegraf as it has a lot of benefits while being mostly API compatible. Its documentation is way better and was built with the learnings from Telegraf which allows for better performance, simpler and more powerful code syntax.
If you care for TypeScript (which is probably true as you seek this issue) then grammY will be way more helpful and correct than Telegraf can as grammY was built with types in mind.