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

Not exporting default class correctly? #16

Open
RuiNtD opened this issue Nov 29, 2022 · 3 comments
Open

Not exporting default class correctly? #16

RuiNtD opened this issue Nov 29, 2022 · 3 comments

Comments

@RuiNtD
Copy link

RuiNtD commented Nov 29, 2022

Not sure what's going on here, but I can't seem to just import the LastFM class, like it says in the README.
I have to construct the class as new LastFMTyped.default(apiKey), which doesn't match the typings.
Possibly because I'm using ESM?

@yayuyokitano
Copy link
Owner

Seems to be an ESM issue yeah. Not entirely sure how to solve this elegantly without breaking backwards-compatibility.
Some seem to suggest adding an additional named import, but it sounds like that might break some stuff with nextjs, though I didn't read up on the details.

That said, I downloaded your repo, and I am struggling to fully reproduce your issue.
On my end I still have the issue of needing to specify LastFMTyped.default, but the default does match the typings on both my macbook and my windows machine. Very odd.

Are you still able to reproduce the typing issue in a freshly downloaded copy?

@RuiNtD
Copy link
Author

RuiNtD commented Dec 3, 2022

Okay, weird. I can't reproduce this issue either anymore. Maybe there was an update to the TypeScript extension? FWIW, I still think this isn't intended. I believe Node has a way to specify separate CommonJS and ESM exports in the package.json

@skyrina
Copy link

skyrina commented Feb 5, 2023

having this issue too

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

3 participants