1

I have the same problem as this post => Finding the correct import for a third party DefinitelyTyped module

I am trying to install VanillaTilt in to my Angular (TS) project. Using this index.d.ts... I saved that d.ts in the same directory as app.component.ts which looks like the following

    import VanillaTilt from 'vanilla-tilt';
    VanillaTilt.init(document.createElement('a'), { perspective: 1000  });

but i get the following ts error ERROR in src/app/app.component.ts(3,8): error TS1192: Module '"vanilla-tilt"' has no default export.

I also tried this version of the d.ts but i kept getting Cannot read property 'init' of undefined

Does anyone have any advice on how to use VanillaTilt in agular5?

Omar
  • 2,726
  • 2
  • 32
  • 65

1 Answers1

2

Typings are available on npm now. First install them

npm install --save-dev @types/vanilla-tilt

Then remove your local .d.ts files

Next, the correct syntax for importing is

import { VanillaTilt } from 'vanilla-tilt';

Because VanillaTilt has a named export , not a default export.

gawicks
  • 1,894
  • 15
  • 22