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
typings - global Bignumber #143
Comments
Please explain what you mean. |
I do use bigNumber in the browser, but i import it using es6 named imports
But now when i skip this import, typescipt does not report any issues and its failing during runtime, cause BigNumber is not found. |
|
Ok, the thing is that for projects in node.js & projects using module loaders including bigNumber as global object in typings is highly error prone and harms developer experience - cause you cannot use auto import. |
Please explain further. Do you mean: because If so, then I see what you mean. But if I take out the |
Yes, so it's a matter of being able to catch the missing import at compile time or with intellisense. But if I remove the I suppose I would have the I'll consider it further. |
This definition creates another (major) issue: The Scenario:
IN this case, there are two copies of
In this case, we get an ERROR from tsc because of the global declarations because we've globally exported n object not a module:
The core reason you're doing this is to make sure that the typings are available for usage when the actual JS is used in a non-module environment. This doesn't make a lot of sense since if they're using Typescript to get the typings they are by definition in a module-supporting environment. And furthermore, if they're NOT then the typings are totally ignored in any case. So I don't see what problem it solves to have this global export accomplished in this particular way, and it is clearly causing problems. |
I can't make complete sense of your post, but, yes, I agree that it would be better to remove the global stuff from the definitions file, as I did recently with decimal.js. I'll get on it presently. |
+1, this is creating issues for me too |
I get the same error as @pgebheim As a workaround, for now, export the BigNumber in my package:
and use it in my project instead of the one imported directly from 'bignumber.js' |
Total nonsense. But anyway, I'll release a new version without the global typings at the end of next week. |
Removed global BigNumber from typings in v7.0.0. |
Thanks for correcting this! I just hit the situation where TS compiled happily, but at runtime BigNumber was missing. The update to v7 did the trick. |
Why bignumber is this defined as global? I think this declaration should be removed cause its really error prone.
The text was updated successfully, but these errors were encountered: