我遇到的问题在标题中。我读过的所有内容都说这是一个打字问题,但我还没有能够找到它。这是一个相当大的项目,所以我只举几个我的设置示例:
tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": ["node_modules", "typings"]
}
typings.json
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160807145350"
}
}
package.json
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/compiler-cli": "0.5.0",
"@angular/forms": "0.3.0",
"@angular/http": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"@angular/router": "3.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.5",
"angular2-in-memory-web-api": "0.0.17",
"bootstrap": "^3.3.6",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.27",
"zone.js": "^0.6.12"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings":"^1.3.3"
}
}
我尝试过的事情:
- 直接在我的应用入口点引用类型文件
- 更改 compilerOptions -> 目标为 es6/es2015
- 卸载并重新安装根目录中的类型引用
- 将 typings.json 更新到最新版本
- 安装 es6-shim 及其类型
任何其他建议将不胜感激。
最佳答案
你上面的 package.json
有 "typescript":"^1.8.10"
,但是如果你已经更新到 2.0.2
在过去一两天内可能是 this bug用 typescript 。如果是这样,降级到早期版本应该可以解决它。
您的错误消息看起来与 this issue 中报告的非常相似在 angular-cli 上 项目。
关于 Angular 2 RC.5 和 VS 2015 : Cannot find name 'module' , 'Set', 'Map', 'MapConstructor', 'SetConstructor',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39255888/