-
Notifications
You must be signed in to change notification settings - Fork 742
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
Fix import types #371
base: master
Are you sure you want to change the base?
Fix import types #371
Conversation
I'm trying to migrate from CommonJS to ES Modules and this issue is getting in the way. I'm seeing errors like the following on
Manually applying the changes from this pull request in @MikeMcl Any hesitation about merging this? I'm happy to help in any way I can. |
It doesn't feel right to add a new file to the project, I think I would prefer to get rid of the type definition files and get AI assistance to add the type definitions as JSDoc comments in the bignumber.js and bignumber.mjs files. Any thoughts? |
I don't think there's anything wrong with shipping two type files, they are technically for different environments (CJS and ESM) 😄 |
It's a bigger npm module. Anyway, I need more time to look at his. I haven't seen that tool before and it's not clear what configuration etc. is being used. |
The size addition would just be the type file so wouldn't effect anyone's compiled code, happy to answer any questions that you have |
Apparently, the |
Sorry I don't fully understand what you mean, I went to the master branch and added I'm fine with the solution being anything, what I opened a PR with is what I got |
Thanks for testing that. I think the current type definitions (not this PR) rely on |
Good point, I hadn't thought about this. Maybe we could introduce two new entrypoints,
This approach would still require you to compile and ship |
Yes, good idea, but it may get quite complex as there is also a class, namespace and function to be exported. I take the point you make about similar duplication. I'll probably accept this PR soon but I am just reacquainting myself with this stuff first, as I don't like accepting changes I don't fully understand. |
This is a very important library to the ecosystem so please take all the time you need to feel comfortable, thank you for making this! I have similar PRs for your other repositories as well: |
https://arethetypeswrong.github.io/?p=bignumber.js%409.1.2
Fix imports and types by copying
bignumber.d.ts
tobignumber.d.mts
.Test with:
npx @arethetypeswrong/cli@latest --pack .