import 'dom-autoscroller' in a typescript file yields 'Can not find module'

1k views Asked by At

I am trying to use 'dom-autoscroller' along with dragula in my angular4/typescript(v2.5) project. I have successfully installed 'dom-autoscroller' npm package but when I try to import AutoScrollerFactory or autoScroll function using following lines, I get the 'Can not find module' error:

  • import AutoScrollerFactory from 'dom-autoscroller/dist/bundle.es';
  • import * as autoScroll from 'dom-autoscroller';

Need to note that I am using VS2015 and the error is shown when the mouse hovered above the 'dom-autoscroller' text.

Any help would be appreciated

1

There are 1 answers

0
HHayat On BEST ANSWER

Finally, I found a workaround to solve the issue by defining a typed version of required functions of dom-autoscroller. Here are the steps:
1. Add script of "node_modules/dom-autoscroller/dist/dom-autoscroller.js" to your .html/.aspx file
2. Declare autoScroll function wherever you want to use it something like this:

declare function autoScroll(elements: any, options: any): any;