Visual Studio 2015 RC3 TypeScript Intellisense 不再工作

Visual Studio 2015 RC3 TypeScript Intellisense not working anymore

我正在使用 TypeScript 1.8.10 和适用于 VS2015 1.8.1.0 Beta 的 TypeScript 工具。 另外,我正在使用 VS2015 RC3

我尝试升级到 TypeScript 2.0,但遇到了完全相同的问题,所以我又回到了 TypeScript 1.8。 我尝试修复 VS2015,更改 tsconfig.json "target" 和 "module" 选项,卸载整个项目并在项目文件中设置 TypeScript 选项,尝试升级 TypeScript 工具,以及很快;但我仍然遇到这些错误:

我的 TypeScript 文件找不到 @angular 包(是的,它们在我的 node_module 文件夹中),即使我有 "experimentalDecorators":我的 tsconfig.json 中的 true 选项。 正如您在下面的屏幕截图中所见,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"
  ]
}

这是我的 package.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 2 : 我发现如果我将 tsconfig.json 目标选项更改为 "es5",我会在 @[=61= 中出现构建错误] 包,即使它之前没有任何问题。它不会改变 es6 和 es5 库的任何内容。

我仍然不知道问题出在哪里,很可能是我的 Visual Studio 配置文件中的一些 TypeScript 配置出了问题,但我通过卸载并重新安装 Visual Studio 解决了我的问题2015 RC3.

升级到 typescript 2.0.3 后我遇到了同样的问题。但我最终还是通过编辑 .jsproj 文件来管理它。我将此条目添加到 .jsproj 文件(在一些导入说明之后)

<PropertyGroup>    
<TypeScriptToolsVersion>2.0</TypeScriptToolsVersion>
</PropertyGroup>

但是,还有一些其他的事情,我必须先解决:

1) 您可能在 weeks/months 之前按照 these 的步骤替换了 typescriptService.js?如果是这样,请用您的(希望现有的)备份再次替换它。

2) 下载 Visual Studio 的 Typescript 并安装 https://www.microsoft.com/en-us/download/details.aspx?id=48593

3) 通过工具 -> 扩展和更新检查 VS 中的 KB 补丁更新。安装它。

4) 尝试弄清楚智能感知是否再次工作(只需创建一个新的 Web/Typescript-project)。如果它在您想要的项目中不起作用,请尝试按上述方法添加 PropertyGroup。

希望对您有所帮助:)

如果 Mica 回答的第 2 步是你的问题,但你无法再从 C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript 访问旧的 typescriptServices.js 然后删除(或者备份以防万一)typescriptServices.js 文件和 Repair 使用 TypeScript 安装程序:https://www.microsoft.com/en-us/download/details.aspx?id=48593

我猜你的 project.Also 中没有 node_modules 文件夹,如果你有那么不要在你的项目中包含该文件夹(通过右键单击它并说包含在项目中)。

只需修复您必须安装一次的打字稿文件。它会为我工作。 右键单击您之前安装的打字稿备份文件,并以管理员身份 运行 并单击修复按钮。重新打开您的项目并查看智能感知的 .ts 文件