Angular 2 gantt chart demo code compilation issue

  1. Downlaoded https://github.com/DHTMLX/angular2-gantt-demo the same
  2. Installed npm
  3. Compiled using ng serve
  4. getting the following error

ERROR in D:/Victor/POC/angular2-gantt-demo-master (1)/angular2-gantt-demo-master/src/app/components/gantt.component.ts (8,16): File
‘D:/Victor/POC/angular2-gantt-demo-master (1)/angular2-gantt-demo-master/node_modules/@types/dhtmlxgantt/index.d.ts’ is not a module.)
D:/Victor/POC/angular2-gantt-demo-master (1)/angular2-gantt-demo-master/src/app/components/gantt.component.ts (8,16): Cannot import
type declaration files. Consider importing ‘dhtmlxgantt’ instead of ‘@types/dhtmlxgantt’.)

Please help me to solve this issue

Thank you for reporting about the issue, we confirmed it.
The type definitions of dhtmlx gantt appear to be not compatible with the typescript version 2.9+.
There are two possible workarounds:

  1. Downgrade typescript to 2.8.x
npm uninstall typescript
npm install typescript@2.8.4
  1. Specify the typescript version in package.json
"typescript": "2.8.4",

If you do not want to downgrade typescript for a single component, you can remove type definitions of dhtmlx gantt and declare gantt instance manually:

declare let gantt: any;

Although, you will lose the type info, that is the lesser of two issues.