Angular - Could not find a declaration file for module ‘dhx-spreadsheet’


#1
import { Component, ElementRef, Input, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Spreadsheet } from 'dhx-spreadsheet';

@Component({
  selector: 'app-spreadsheet',
  template: `<div #widget class='widget-box-wide'></div>`
})
export class SpreadsheetComponent implements OnInit, OnDestroy {
  @ViewChild('widget', {static: true}) container: ElementRef;
  spreadsheet: Spreadsheet;

  @Input() toolbar: string[];
  @Input() menu: boolean;
  @Input() editLine: boolean;
  @Input() rowsCount: number;
  @Input() colsCount: number;


  ngOnInit() {
    this.spreadsheet = new Spreadsheet(this.container.nativeElement, {
      toolbar: this.toolbar,
      menu: this.menu,
      editLine: this.editLine,
      rowsCount: this.rowsCount,
      colsCount: this.colsCount,
    });
  }

  ngOnDestroy() {
    this.spreadsheet.destructor();
  }
}

I have this component call spreadsheet.component.ts as shown above in my Angular project.

However, when i compile and run the project with this component, there isn’t any issue but my whole project will not run and in the console it shows this error:

Uncaught TypeError: Cannot read property 'setImmediate' of undefined
    at spreadsheet.min.js:12
    at Object.<anonymous> (spreadsheet.min.js:12)
    at Object.<anonymous> (spreadsheet.min.js:12)
    at n (spreadsheet.min.js:12)
    at Object.<anonymous> (spreadsheet.min.js:12)
    at n (spreadsheet.min.js:12)
    at Object.<anonymous> (spreadsheet.min.js:12)
    at n (spreadsheet.min.js:12)
    at Object.<anonymous> (spreadsheet.min.js:12)
    at n (spreadsheet.min.js:12)
    at spreadsheet.min.js:12
    at spreadsheet.min.js:12
    at push../node_modules/dhx-spreadsheet/codebase/spreadsheet.min.js.dhx_legacy.<computed> (spreadsheet.min.js:12)
    at Object../node_modules/dhx-spreadsheet/codebase/spreadsheet.min.js (spreadsheet.min.js:12)
    at __webpack_require__ (bootstrap:79)
    at Module../src/app/spreadsheet/spreadsheet.component.ts (spreadsheet.component.ts:1)

At the same time when i take a closer look at my spreadsheet.component.ts file, i notice a warning stating that “Could not find a declaration file for module ‘dhx-spreadsheet’.
‘/normalAngularApp/node_modules/dhx-spreadsheet/codebase/spreadsheet.min.js’ implicitly has an ‘any’ type.
Try npm install @types/dhx-spreadsheet if it exists or add a new declaration (.d.ts) file containing declare module 'dhx-spreadsheet';ts(7016)”

I’ve tried npm install @types/dhx-spreadsheet and it didn’t work with error showing that there is no such type.
And declare module ‘dhx-spreadsheet’ will cause an error that argued namespace cannot be read as a type.

Any experts here to advise?