简体   繁体   English

使用带有Typescript的decimal.js

[英]Using decimal.js with Typescript

I am trying to use decimal.js with Typescript on the client side of a simple app that was booted with create-react-app - Typescript 2.8.1. 我试图在用create-react-app-Typescript 2.8.1启动的简单应用程序的客户端上使用带有Typescript的decimal.js。

But even for a simple declaration of a = new Decimal(1) I'm just getting an error: 但是,即使对于简单的a = new Decimal(1)声明,我也只会收到一个错误:

TypeError: __WEBPACK_IMPORTED_MODULE_0 default.a is not a constructor TypeError:__WEBPACK_IMPORTED_MODULE_0 default.a不是构造函数

I can't figure out what's exactly the problem. 我不知道到底是什么问题。 Nothing useful on Google. 对Google没什么用。

您必须导入为decimal.js/decimal

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM