Beta 10: How to import a JS lib with no type definition?


#1

In beta 9 I was able to import as follows:

  1. Install from NPM (npm install js-data-localstorage)
  2. import * as DSLocalStorageAdapter from ‘js-data-localstorage’;

In beta 10 I’ve got this issue:
TypeScript error: /home/me/project/app/providers/data-service/data-service.ts(3,40): Error TS2307: Cannot find module ‘js-data-localstorage’.


#2

Hi, if you don’t have the typings I’d suggest you use requirejs. You can easily install it via NPM but make sure that you install the requirejs typings, otherwise it won’t be recognised in Typescript