I am attempting to incorporate the Loess package into my project. The package can be found on NPM and offers various regression models for data fitting. I successfully installed it using npm install loess --save
, and it now resides in the node_modules directory.
However, I am encountering difficulties when trying to use its constructor within my component. In my component file, I have imported the necessary statements as follows:
import { Component, OnInit, Input, PLATFORM_ID, Inject } from '@angular/core';
import * as d3 from 'd3';
import * as loess from 'loess';
import { isPlatformBrowser } from '@angular/common';
Despite this, I am unable to invoke the constructor in my code,
neither with
var model = new loess.Loess(data, options);
nor with
var model = new Loess(data, options);
Whenever I attempt to do so, my developer console displays the error message:
ERROR TypeError: loess.Loess is not a constructor
at daily.component.ts?5fea:52
(or in the second scenario with just new Loess([...])
)
How can I effectively call the constructor of the class in Typescript/Angular? While I understand that there are no typings available for Loess, this shouldn't pose a significant issue, right?