I have an Angular2 application that is built using WebPack. I upgraded WebPack from v1.8 to v2 and everything seems to be working fine. The only problem is that the old code has the following:
import Timer = NodeJS.Timer;
....
apptInterval: Timer;
....
this.apptInterval = setInterval(() => { ... }, 1000);
After the update, this gives me an error: TS2503: Cannot find namespace 'NodeJS'.
tsconfig.json is as follows:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
Docs for Angular / Webpack no longer have typings.json
; however, even if I copy from the Webpack 1 directory, this does not help. Content - typings.json
{
"globalDependencies": {
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node"
}
}
Interestingly, if I remove the links to NodeJS, everything will be fine. Like this:
apptInterval: any;
....
this.apptInterval = setInterval(() => { ... }, 1000);
F12, apptInterval ZoneTask
. , , . , , typings install dt~node --global --save-dev
( typings.json, .