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

global import for typescript #230

Open
Akimotorakiyu opened this issue Apr 8, 2019 · 2 comments
Open

global import for typescript #230

Akimotorakiyu opened this issue Apr 8, 2019 · 2 comments

Comments

@Akimotorakiyu
Copy link

Akimotorakiyu commented Apr 8, 2019

bignumber.js in TheoremJS with typescript

arguiot/TheoremJS#25

I need import bignumber.js globally for browser, import bignumber.js as a module for node.
图片

In this case, for browser , need a global kind .d.ts file.
图片
and then it works
图片

But bignumber.js only has a module kind .d.ts file.
图片

@Akimotorakiyu
Copy link
Author

Akimotorakiyu commented Apr 8, 2019

may a module-class kind .d.ts file is better.

see here or below picture.

图片

@MikeMcl
Copy link
Owner

MikeMcl commented Apr 8, 2019

Yes, previously the .d.ts file did include global typings, see #143.

I'll consider creating a separate global typings file, as I did with decimal.js.

Note to myself: previously the .d.ts file contained the following at the end of the file.

declare global {
  const BigNumber: BigNumberConstructor;
  type BigNumber = BigNumberInstance;
  namespace BigNumber {
    type Config = BigNumberConfig;
    type Constructor = BigNumberConstructor;
    type Format = BigNumberFormat;
    type Instance = BigNumberInstance;
    type ModuloMode = BigNumberModuloMode;
    type RoundingMode = BigNumberRoundingMode;
    type Value = BigNumberValue;
  }
}

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
@MikeMcl @Akimotorakiyu and others