After updating my application to Angular2 v2.0.0-rc.1, I am encountering TypeScript compile errors and warnings when webpack bundles my application. These messages appear for any @angular
packages referenced in my TypeScript source files:
ERROR in ./src/app/app.ts
(1,34): error TS2307: Cannot find module '@angular/core'.
ERROR in ./src/app/app.ts
(3,76): error TS2307: Cannot find module '@angular/common'.
ERROR in ./src/app/app.ts
(4,30): error TS2307: Cannot find module '@angular/http'.
In previous beta versions of Angular2, I resolved similar issues with classes like Promise
and Map
by including a reference at the beginning of my app.ts
file.
///<reference path="node_modules/angular2/typings/browser.d.ts"/>
I am wondering if there is a d.ts
file available for the @angular
packages that can resolve this issue. So far, my search within the typings
system has yielded no results:
MFO-Mac:angular2-oauth2 mfo$ typings search '@angular'
No results found for search
Currently, my TypeScript tsconfig.json
file is set to target ES6. However, switching it to target ES5 eliminates the @angular
errors but introduces errors for common ES6 classes such as Promise
, Set
, and Map
. Here is my configuration for ES6:
{
"version": "1.6.2",
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es6",
"module": "commonjs",
"removeComments": true,
"sourceMap": true
},
"exclude": [
"node_modules",
"bower_components",
"bootstrap"
],
"files": [],
"definitions": [
]
}
I suspect that listing files in node_modules/@angular
under the definitions
section of the tsconfig.json
file could potentially solve the issue, but I lack sufficient knowledge on how TypeScript typedef files function.
If there is an alternative solution to address this problem, I am open to exploring other options as well.