I would recommend using some tool to manage your definitions. Some popular options (you do not need both, just choose one):
tsd - npm i -g tsdtypings - npm i -g typings
They work similarly to package managers. You can set your definitions, for example, npm / bower installs your dependencies.
Once you have installed one of them, go to your project and set the moment + its definition
npm install moment
And one of them:
tsd install moment
Both of them will create a folder with your definitions in it (both call it typifications), and both have an umbrella definition file in it that you must reference at the entry point of your application (first for tsd, the second for typing):
/// <reference path="typings/tsd.d.ts" /> /// <reference path="typings/index.d.ts" />
After that, you can use the moment (or any other module) like you:
import * as moment from 'moment' moment.isDate("I'm not a date")
I suggest checking them out:
https://github.com/DefinitelyTyped/tsd
https://github.com/typings/typings
source share