Javascript Big.js Typescript错误:当'--隔离模块';提供标志。ts(2748)
我在Typescript react应用程序中使用了Javascript Big.js Typescript错误:当'--隔离模块';提供标志。ts(2748),javascript,reactjs,typescript,decimal.js,big.js,Javascript,Reactjs,Typescript,Decimal.js,Big.js,我在Typescript react应用程序中使用了big.js,下面的代码 const toFixedRounding = { [Rounding.ROUND_DOWN]: RoundingMode.RoundDown, [Rounding.ROUND_HALF_UP]: RoundingMode.RoundHalfUp, [Rounding.ROUND_UP]: RoundingMode.RoundUp, }; 使用RoundingMode 当提供'--isolatedModu
big.js
,下面的代码
const toFixedRounding = {
[Rounding.ROUND_DOWN]: RoundingMode.RoundDown,
[Rounding.ROUND_HALF_UP]: RoundingMode.RoundHalfUp,
[Rounding.ROUND_UP]: RoundingMode.RoundUp,
};
使用RoundingMode
当提供'--isolatedModules'标志时,无法访问环境常数枚举。ts(2748)
为什么会出现这种错误,有没有办法解决?谢谢大家!
测试.tsx
import JSBI from "jsbi";
import invariant from "tiny-invariant";
import _Decimal from "decimal.js-light";
import _Big, { RoundingMode } from "big.js";
import toFormat from "toformat";
import { BigintIsh, Rounding } from "../constants";
const Decimal = toFormat(_Decimal);
const Big = toFormat(_Big);
const toSignificantRounding = {
[Rounding.ROUND_DOWN]: Decimal.ROUND_DOWN,
[Rounding.ROUND_HALF_UP]: Decimal.ROUND_HALF_UP,
[Rounding.ROUND_UP]: Decimal.ROUND_UP,
};
const toFixedRounding = {
[Rounding.ROUND_DOWN]: RoundingMode.RoundDown, // <==== error occurs here
[Rounding.ROUND_HALF_UP]: RoundingMode.RoundHalfUp, // <==== error occurs here
[Rounding.ROUND_UP]: RoundingMode.RoundUp, // <==== error occurs here
};
从“JSBI”导入JSBI;
从“微小不变量”导入不变量;
从“Decimal.js light”导入_Decimal;
从“Big.js”导入_Big,{RoundingMode};
从“toFormat”导入toFormat;
从“./constants”导入{BigintIsh,舍入};
常量十进制=toFormat(_十进制);
const Big=toFormat(_Big);
const to significantorounding={
[四舍五入.向下四舍五入]:十进制.向下四舍五入,
[四舍五入.向上四舍五入]:十进制.向上四舍五入,
[四舍五入,四舍五入]:十进制,四舍五入,
};
常数toFixedRounding={
[取整。向下取整]:取整模式。向下取整//