I would like to use moment.js in my node application, so I installed instant.js using the node npm package manager:
npm install moment@2.4.0
Just to be safe, I checked a point that is not installed globally, and the installed version is actually version 2.4.0 (version 2.4.0, to use the correct d.ts file ...)
require("moment").version
Good, seems good. I also use the latest version of TypeScript (0.9.5).
So, now I added the following file to the root directory of the projects https://github.com/borisyankov/DefinitelyTyped/blob/master/moment/moment.d.ts and redirected the file:
Now it should work to import the moment using the import TypeScripts keyword:
import m = require("moment");
Compiling with the following command
tsc app.ts --module commonjs
produces the following errors:
/home/unknown/temp/test/app.ts(3,1): error TS2071: it is not possible to solve the external module "moment". /home/unknown/temp/test/app.ts(3,1): error TS2072: the module cannot be an alias for a non-modular type.
Why does this error occur? How to fix it?
System.Data
source share