I'm just starting with front-end web developpement(javascript hell with all these package manager/bundler) and I'm trying to use typescript + browsify
so I create a index.ts file and download the uniq module(using npm) just to test ts file compilation
here is my index.ts
/// <reference path="node_modules/uniq/uniq.d.ts" />
import {unique} from "uniq";
var data = [1, 2, 2, 3, 4, 5, 5, 5, 6];
console.log(unique(data));
uniq.d.ts
// Type definitions for uniq
// Project: https://www.npmjs.com/package/uniq
// Definitions by: Hans Windhoff <https://github.com/hansrwindhoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Uniq{
<T>(ip:Array<T>): Array<T>;
}
declare var uniq :Uniq;
declare module "uniq" {
export = uniq;
}
directory structure
.
├── entry.ts
├── node_modules
│ └── uniq
│ ├── LICENSE
│ ├── package.json
│ ├── README.md
│ ├── test
│ │ └── test.js
│ ├── uniq.d.ts
│ └── uniq.ts
└── package.json
but when I try to compile the index.ts I got this error :
error TS2688: Cannot find type definition file for 'uniq'.
typingsdefinition for it? You currently have your reference pointing to the definition file in the typings folder, but I don't see that in your directory structure.