I\'m trying to learn Typescript. While I don\'t think it\'s relevant, I\'m using VSCode for this demo.
I have a package.json
that has these pieces in it
via typings
Moment.js now supports TypeScript in v2.14.1.
See: https://github.com/moment/moment/pull/3280
Directly
Might not be the best answer, but this is the brute force way, and it works for me.
moment.js
file and include it in your project.
$ tree
.
├── main.js
├── main.js.map
├── main.ts
└── moment.js
```
import * as moment from 'moment';
class HelloWorld {
public hello(input:string):string {
if (input === '') {
return "Hello, World!";
}
else {
return "Hello, " + input + "!";
}
}
}
let h = new HelloWorld();
console.log(moment().format('YYYY-MM-DD HH:mm:ss'));
node
to run main.js
.