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

StringSession is not assignable to Session? #56

Closed
foodornt opened this issue Feb 15, 2021 · 4 comments
Closed

StringSession is not assignable to Session? #56

foodornt opened this issue Feb 15, 2021 · 4 comments

Comments

@foodornt
Copy link

Argument of type 'StringSession' is not assignable to parameter of type 'string | Session'.
  Type 'StringSession' is not assignable to type 'Session'.
    Types of property 'authKey' are incompatible.
      Type 'import("/home/darda/code/js/telenode/node_modules/telegram/gramjs/crypto/AuthKey").AuthKey | undefined' is not assignable to type 'import("/home/darda/code/js/telenode/node_modules/telegram/dist/crypto/AuthKey").AuthKey | undefined'.
        Type 'import("/home/darda/code/js/telenode/node_modules/telegram/gramjs/crypto/AuthKey").AuthKey' is not assignable to type 'import("/home/darda/code/js/telenode/node_modules/telegram/dist/crypto/AuthKey").AuthKey'.
          Types have separate declarations of a private property '_key'.

what's wrong? I installed using yarn

@painor
Copy link
Member

painor commented Feb 15, 2021

huh. probably has to do with the change of the structure. lemme push a small fix.

@painor
Copy link
Member

painor commented Feb 15, 2021

btw can you share your imports? it looks like you're importing from both /dist and the normal location

@foodornt
Copy link
Author

btw can you share your imports? it looks like you're importing from both /dist and the normal location

Sure

import { TelegramClient } from "telegram"
import { StringSession } from "telegram/gramjs/sessions/StringSession"

am I doing it wrong?

@foodornt
Copy link
Author

Hell yeah I was doing it wrong, I was supposed to import StringSession from telegram/dist/sessions and not gramjs/.
Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants