I am working on angular 2 project with angular-cli (1.0.0-beta.10) and want to use this library (https://github.com/Glench/fuzzyset.js). When I try to import it, Typescript is not accepting it as a module I don’t really know why. It gives me Cannot find module
error.
As a workaround I tried to declare it as module in my system-config.ts
file
declare module "fuzzyset" {}
I am importing it in one of my component like this
import * as FuzzySet from 'fuzzyset';
and added to System Config:
System.config({
paths: {
// paths serve as alias
'npm:': 'vendor/'
},
map: {
'fuzzyset': 'npm:fuzzyset.js/index.js',
},
packages: cliSystemConfigPackages
});
But now it gives Cannot invoke an expression whose type lacks a call signature.
To solve this error I changed the module declaration to this:
declare module "fuzzyset" {
export function FuzzySet(options?:any): any;
}
This does work in a way that everything is compiled, but then I am getting error at runtime as follow: Browser console errors
Can anyone help me on this? Thanks in advance :)