Question: Alright, my first question on SO, how exciting! :)

I am trying to get MomentJS definitions to work with Typescript 2.0.

I have no issues in getting Angular definitions to work, simply by doing `npm install @types/angular --save-dev`.

However, MomentJS (2.15.1) already comes with `moment.d.ts` as part of the package you get when you install it.

If you try to do a similar approach to angular, i.e. `npm install @types/moment --save-dev`, this is what you get:

> 
> npm WARN deprecated @types/moment@2.13.0: This is a stub types definition for Moment (<https://github.com/moment/moment>). Moment provides its own type definitions, so you don't need @types/moment installed!
> 
> 
> 

And surely enough, if you go to `node_modules\@types\moment`, there's nothing useful in there.

Yes, I have added the `tsconfig.json` file on my root folder, so Typescript 2.0 will automatically pick up the @types on node\_modules (this is why Angular works fine), but for MomentJS I get the error below (since the .d.ts is not on the place where TS2 expects it to be):

> 
> TS2304 Cannot find name 'moment'.
> 
> 
> 

I also tried playing around with the `"typeRoots"` config on `tsconfig.json` without any luck.

This is the relevant piece of my `package.json`:

```
{
  "devDependencies": {
    "@types/angular": "^1.5.16"
  },
    "dependencies": {
        "moment": "^2.15.1"
    }
}

```

I am using VS2015, if this matters.

So... Any ideas on how to get Typescript 2.0 to read the type definition for Moment, that sits on an "unexpected" folder?

Answer: 
I found somewhere else (but don't remember where), that you should

change moment.d.ts by replacing export statement with

```
declare module 'moment' {
   export default moment;
}

```

add dummy file fixmoment.ts to your project with following line

```
import * as moment from 'moment';

```

Compiling with tsc directly now compiles all files. Unfortunately VS2015 still gives an error 
*tsc : error TS2688: Build:Cannot find type definition file for 'moment'.*
which I don't understand.
Doing the following in a `customer-typings.d.ts` file worked for me

```
///<reference path="node_modules/moment/moment.d.ts"/>
import moment = Moment;
declare const moment: Moment;

```

I didn't even need to make any changes to ts `tsconfig.json` file