Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type issue with export = LocalSession #147

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

Vico1993
Copy link

@Vico1993 Vico1993 commented Jun 1, 2021

Hey!

I used telegraf-session-local on one of my bot.
Like this issue: #117
I got an issue with export = LocalSession. My project couldn't build.

I propose this fix. That's how I import LocalSession in my project after the fix:

const LocalSession = require('telegraf-session-local')

And it worked fine.

Let me know your though!

…peaker#115)

Updates the requirements on [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) to permit the latest version.
- [Release notes](https://github.com/xjamundx/eslint-plugin-promise/releases)
- [Changelog](https://github.com/xjamundx/eslint-plugin-promise/blob/development/CHANGELOG.md)
- [Commits](eslint-community/eslint-plugin-promise@v4.2.1...v4.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Updates the requirements on [eslint](https://github.com/eslint/eslint) to permit the latest version.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.19.0...v7.21.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Updates the requirements on [mocha](https://github.com/mochajs/mocha) to permit the latest version.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](mochajs/mocha@v8.2.1...v8.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
…aker#122)

Updates the requirements on [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha) to permit the latest version.
- [Release notes](https://github.com/lo1tuma/eslint-plugin-mocha/releases)
- [Changelog](https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/CHANGELOG.md)
- [Commits](lo1tuma/eslint-plugin-mocha@8.0.0...8.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Updates the requirements on [telegraf](https://github.com/telegraf/telegraf) to permit the latest version.
- [Release notes](https://github.com/telegraf/telegraf/releases)
- [Commits](telegraf/telegraf@v4.0.2...v4.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Updates the requirements on [eslint](https://github.com/eslint/eslint) to permit the latest version.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.21.0...v7.24.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Updates the requirements on [mocha](https://github.com/mochajs/mocha) to permit the latest version.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](mochajs/mocha@v8.3.1...v8.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Updates the requirements on [telegraf](https://github.com/telegraf/telegraf) to permit the latest version.
- [Release notes](https://github.com/telegraf/telegraf/releases)
- [Commits](telegraf/telegraf@v4.2.1...v4.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c53eddf on Vico1993:master into 19976d9 on RealSpeaker:master.

@TemaSM TemaSM requested a review from EdJoPaTo June 1, 2021 15:32
@EdJoPaTo
Copy link
Collaborator

EdJoPaTo commented Jun 1, 2021

require imports are kinda deprecated in TypeScript. The way to go are ECMA Modules. TypeScript uses them natively.
So with typescript you should import this way:

import LocalSession from 'telegraf-session-local';

You change changes the export from being "the" export to being one of the exports with the name LocalSession.
The library itself does not export as the name and the typings should do the same:

module.exports = LocalSession

The best way of solving that would probably be to fully migrating to TypeScript which #119 attempts. Then the typings and the actual code are not strangely out of sync. Maybe I should try to find time for that PR again…

Do you build with or without esModuleInterop enabled? In many cases its a simple solution to just enable that.

dependabot bot added 7 commits June 5, 2021 17:01
Updates the requirements on [mocha](https://github.com/mochajs/mocha) to permit the latest version.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](mochajs/mocha@v8.3.2...v8.4.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [jsdoc](https://github.com/jsdoc/jsdoc) to permit the latest version.
- [Release notes](https://github.com/jsdoc/jsdoc/releases)
- [Changelog](https://github.com/jsdoc/jsdoc/blob/3.6.7/CHANGES.md)
- [Commits](jsdoc/jsdoc@3.6.6...3.6.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [eslint](https://github.com/eslint/eslint) to permit the latest version.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.24.0...v7.28.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha) from 8.2.0 to 9.0.0.
- [Release notes](https://github.com/lo1tuma/eslint-plugin-mocha/releases)
- [Changelog](https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/CHANGELOG.md)
- [Commits](lo1tuma/eslint-plugin-mocha@8.2.0...9.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…alSpeaker#141)

Updates the requirements on [eslint-config-standard](https://github.com/standard/eslint-config-standard) to permit the latest version.
- [Release notes](https://github.com/standard/eslint-config-standard/releases)
- [Changelog](https://github.com/standard/eslint-config-standard/blob/master/CHANGELOG.md)
- [Commits](standard/eslint-config-standard@v16.0.2...v16.0.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) from 4.3.1 to 5.1.0.
- [Release notes](https://github.com/xjamundx/eslint-plugin-promise/releases)
- [Changelog](https://github.com/xjamundx/eslint-plugin-promise/blob/development/CHANGELOG.md)
- [Commits](https://github.com/xjamundx/eslint-plugin-promise/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…Speaker#148)

Updates the requirements on [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) to permit the latest version.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](import-js/eslint-plugin-import@v2.22.1...v2.23.4)

---
updated-dependencies:
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
TemaSM and others added 8 commits June 7, 2021 16:29
Bumps [mocha](https://github.com/mochajs/mocha) from 8.4.0 to 9.0.1.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](mochajs/mocha@v8.4.0...v9.0.1)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [eslint](https://github.com/eslint/eslint) to permit the latest version.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.28.0...v7.29.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [mocha](https://github.com/mochajs/mocha) to permit the latest version.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](mochajs/mocha@v9.0.1...v9.0.2)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [eslint](https://github.com/eslint/eslint) to permit the latest version.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.29.0...v7.30.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [telegraf](https://github.com/telegraf/telegraf) to permit the latest version.
- [Release notes](https://github.com/telegraf/telegraf/releases)
- [Commits](telegraf/telegraf@v4.3.0...v4.4.0)

---
updated-dependencies:
- dependency-name: telegraf
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@Vico1993
Copy link
Author

I did try withesModuleInterop enable and without it... same error :/

I agree that your PR #119 will make more sense than this change

@TEHbKA-dev
Copy link

Hey!
How to solve this problem?

An export assignment cannot be used in a module with other exported elements.

34 export = LocalSession

@qWici
Copy link

qWici commented Nov 18, 2021

@TemaSM any updates?

@EdJoPaTo
Copy link
Collaborator

@qWici see #119 (comment)

Personally I switched from telegraf to grammY and plan on using grammy-file-storage which has simpler code and compatibility with both Deno and Node.js.

@kekemeke
Copy link

kekemeke commented Dec 6, 2021

still not merged?

@EdJoPaTo
Copy link
Collaborator

EdJoPaTo commented Dec 6, 2021

@kekemeke see both of my messages. Firstly this PR is technically wrong as the typings differ from the sources. Secondly you might want to consider switching to grammY.

grammY has a way better way of handling sessions compared to Telegraf which throws out a lot of complexity while allowing for more demanding use cases.

Somewhere on my TODO list is the migration of telegraf-session-local data to grammy-file-storage data any grammY storage adapter. When I have done that I want to write a small guide on how to do that for other people with the same problem. If you write a script or so to do that feel free to share!

@EdJoPaTo EdJoPaTo mentioned this pull request Apr 11, 2022
@TemaSM TemaSM self-assigned this Jan 9, 2023
@TemaSM TemaSM added this to the v3.x milestone Jan 9, 2023
@TemaSM TemaSM force-pushed the master branch 3 times, most recently from 55b4ac1 to ffdd632 Compare January 11, 2023 03:19
@TemaSM TemaSM force-pushed the master branch 3 times, most recently from da156d6 to 11fb25c Compare January 29, 2023 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants