I'm in the process of converting a website to use TypeScript and I'm converting just one of many JavaScript files to TypeScript. All pages of my site already reference moment.js, such as:
<script src="/scripts/moment.min.js"></script>
I've added other TypeScript definition files using:
npm install --save-dev @types/jquery
... But, the above seems like the wrong choice for moment. When I use the above command (but substitute 'moment' for 'jquery'), a readme file is downloaded that says:
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!
As a solution, I tried saving the moment.d.ts file from its GitHub repo and referencing it in the TypeScript file as so:
///<reference path="../../Scripts/typeDeclarations/moment.d.ts"/>
var now:any = moment.utc();
But, TypeScript gives me the warning:
Cannot find the name 'moment'