user3666882 user3666882 - 2 years ago 207
TypeScript Question

dhtmlxscheduler with Aurelia and typescript

I'm trying to install

to my Aurelia CLI (typescript) app. I've npm installed it:

npm i dhtmlx-scheduler

Then I added it to the

"name": "dhtmlx-scheduler",
"path": "../node_modules/dhtmlx-scheduler/codebase",
"main": "dhtmlxscheduler"

And created the global typings for it:

typings install dt~dhtmlxscheduler --global --save

everything installed and
au run
compiles correctly. When I try to actually use the the library though I get this error:

error TS2307: Cannot find module 'dhtmlxscheduler'.
[02:00:15] gulp-notify: [Error running Gulp] Error: src/components/appointments/appointments.ts(2,20): error TS2307: Cannot find module 'dhtmlxscheduler'.

I'm importing it like so:

import * as scheduler from 'dhtmlxscheduler';

Answer Source

I looked into dhtmlxscheduler.js and it doesn't export any member properties. Doing import * as scheduler from 'dhtmlxscheduler'; should give you an error.

Instead, import the entire module:

import 'dhtmlx-scheduler'; // Taking into account the comment that I left above

Then you can call the scheduler function directly in your class.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download