I want to use big.js or decimal.js to perform accurate calculations of decimal numbers in my basic Svelte app. To test it, I have imported the module in my App.svelte file:
import Decimal from "../node_modules/decimal.js/decimal.mjs";
import Big from "../node_modules/big.js/big.mjs";
However, when I create a Big object and use its built-in functions, I get an error in my IDE (Visual Studio Code), but the code works as expected in the console:
let myNumber = 3.2;
let secondNumber = new Big(myNumber).div(2);
Error: Property 'div' does not exist on type 'Big'
How can I get my IDE to recognise imported objects from modules? To clarify, I am not using typescript.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/R5uPKkB
Comments
Post a Comment