3
votes

Im trying to import typings for swiper to angular2.

I've installed swiper and its typings via npm, but in my component when I include swiper

import { Swiper } from 'swiper';

atom shows error:

path/../@types/swiper/index.d.ts is not a module

Is it possible that the typings are badly declared or is it my fault?

1
For me, using VSCode, every time I install new typings, I need to restart or else I get the same error as you're getting. Pretty tedious. Not sure if it's the same with Atom - Paul Samsotha
have you tried change index.d.ts to main.d.ts? - brian_wang

1 Answers

0
votes

When it comes to module errors the 1.2.3 is:

  1. save the file (continue if persists)
  2. close the file tab, reopen the file tab
  3. restart the IDE
  4. run tsc to see if it also has a problem
  5. check the index.d.ts for validness (case by case)
  6. if all else fails, delete the typings and stub your own 'empty module' in, say, index.d.ts in your src/ folder