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

Add default import in twitter.js #139

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

Conversation

kissarat
Copy link

@kissarat kissarat commented Sep 1, 2020

There declaration in index.d.ts

export default class Twitter {

But without this PR it is impossible to import this way

import Twitter from 'twitter-lite'

Because for exporting

module.exports = Twitter

Import must looks like

import * as Twitter from 'twitter-lite'

But it's not described in index.d.ts

twitter.js Outdated
@@ -354,3 +354,5 @@ class Twitter {
}

module.exports = Twitter;

Twitter.default = Twitter;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this line be moved above module.exports, or is it hoisted?

Copy link
Author

@kissarat kissarat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe such code are more clear, but it's not possible to put module.exports.default = Twitter before module.exports = Twitter

@kissarat
Copy link
Author

kissarat commented Mar 7, 2021

@fdebijl I'm not sure that I'm not sure that I understand you well, but I made an appropriate changes

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

Successfully merging this pull request may close these issues.

2 participants