Angular 2 RC.5 和 VS 2015 : Cannot find name 'module' , 'Set', 'Map', 'MapConstructor', 'SetConstructor'

标签 angular typescript typescript-typings

我遇到的问题在标题中。我读过的所有内容都说这是一个打字问题,但我还没有能够找到它。这是一个相当大的项目,所以我只举几个我的设置示例:

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"
  }
}

我尝试过的事情:

  1. 直接在我的应用入口点引用类型文件
  2. 更改 compilerOptions -> 目标为 es6/es2015
  3. 卸载并重新安装根目录中的类型引用
  4. 将 typings.json 更新到最新版本
  5. 安装 es6-shim 及其类型

任何其他建议将不胜感激。

enter image description here

最佳答案

你上面的 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/

相关文章:

javascript - Angular 6 - 由于 NGRX,生产构建失败

使用全局注入(inject)器的 Angular 7 组件继承

reactjs - 具有 "GetWrappedInstance"的元素的正确接口(interface)是什么

typescript - tsconfig.json typeroots 自定义路径未被拾取

typescript - 使用 TypeScript 和 Emotion 设计 Reach UI

css - 如何以不同的分辨率指定 Material 2 底板的宽度

angular - ionic2:无法从弹出窗口导航到另一个页面

javascript - Angular 自定义空闲计时器

javascript - typescript 打字封装

typescript - 强制 TypeScript 在悬停时显示变量的最终状态