I am attempting to integrate the numbro JavaScript library into my TypeScript project. The numbro.d.ts file exports like this:
declare const numbro: NumbroStatic;
export default numbro;
My simple import statement looks like this:
import numbro from 'numbro';
var string = numbro(1000).format('0,0');
console.log(string);
When I compile the TypeScript code, there are no errors. However, the generated JavaScript code shows:
"use strict";
var numbro_1 = require('numbro');
var string = numbro_1["default"](1000).format('0,0');
console.log(string);
Upon executing the code, I encounter the error:
numbro_1.default is not a function
If I manually change the JavaScript code to:
numbro_1(1000).format('0,0');
Then it works fine. Is there an issue with their JavaScript export or is it something in my code? Any help would be appreciated. Thank you.