我正在使用 TypeScript 1.8.10 和 TypeScript Tools for VS2015 1.8.1.0 Beta。
另外,我正在使用 VS2015 RC3
我尝试升级到 TypeScript 2.0,但遇到了完全相同的问题,所以我又回到了 TypeScript 1.8。
我尝试修复 VS2015,更改 tsconfig.json“目标”和“模块”选项,卸载整个项目并在项目文件中设置 TypeScript 选项,尝试升级 TypeScript 工具,等等;但我仍然收到这些错误:
我的 TypeScript 文件找不到 @angular 包(是的,它们在我的 node_module 文件夹中),我什至收到实验装饰器错误,即使我有“experimentalDecorators”:true我的 tsconfig.json 中的选项。
正如您在下面的屏幕截图中看到的那样,TypeScript 库存在很多错误:lib.d.ts 和 lib.es6.d.ts
问题是我的构建编译没有任何问题,但我遇到了无数的智能感知错误,而且我无法再使用 TypeScript 进行编码,所以我现在真的无法再工作了......
这是我的tsconfig.json :
{
"compilerOptions": {
"outDir": "./wwwroot/app/",
"target": "es6",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"exclude": [
"wwwroot",
"node_modules",
"typings",
"typings/main",
"typings/main.d.ts"
]
}
这是我的包.json :
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"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/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.15",
"systemjs": "0.19.36",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.11",
"zone.js": "^0.6.12"
},
"devDependencies": {
"typescript": "^1.8.10",
"typings": "^1.0.4",
"gulp": "^3.9.1",
"path": "^0.12.7",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.0",
"gulp-typescript": "^2.13.1",
"gulp-tsc": "^1.1.5",
"run-sequence": "^1.2.2"
}
}
这是我无数的智能感知错误的屏幕截图:
任何帮助将不胜感激,我真的对这些错误感到迷失,我不知道该怎么办了...我想我可以完全重新安装 VS 2015,但如果可能的话我想避免这样做。
EDIT :添加项目截图:
EDIT 2 :我发现,如果我将 tsconfig.json 目标选项更改为“es5”,我会在 @Angular 包中遇到构建错误,即使它之前没有任何问题。它不会改变 es6 和 es5 库的任何内容。