Leonardo Lozano
Leonardo Lozano

Reputation: 81

Moving from typings to @types in Visual Studio 2015

Getting rid off the typings configuration and adding @types instead has produced a series of errors while compiling the project. Apparently @types/core-js can be seen by the typescript compiler and VS IntelliSense.

Here an example of one of the many errors

Severity    Code    Description Project File    Line    Suppression State
Error   TS2304  Cannot find name 'Set'. TypeScript Virtual Projects C:\Projects\Cool\Project\node_modules\@angular\common\src\directives\ng_class.d.ts  46  Active

Severity    Code    Description Project File    Line    Suppression State
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects C:\Projects\Cool\Project\node_modules\@angular\common\src\pipes\async_pipe.d.ts 44  Active

Set and Promise are defined by core-js

Following package.json configuration

"name": "Cool",
  "private": true,
  "scripts": {
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  },
  "dependencies": {
    "@angular/common": "~2.1.1",
    "@angular/compiler": "~2.1.1",
    "@angular/core": "~2.1.1",
    "@angular/forms": "~2.1.1",
    "@angular/http": "~2.1.1",
    "@angular/platform-browser": "~2.1.1",
    "@angular/platform-browser-dynamic": "~2.1.1",
    "@angular/router": "~3.1.1",
    "@angular/upgrade": "~2.1.1",
    "@types/core-js": "^0.9.34",
    "@types/mcustomscrollbar": "^2.8.30",
    "angular-in-memory-web-api": "~0.1.13",
    "animate.css": "3.5.2",
    "bootstrap": "~3.3.5",
    "core-js": "^2.4.1",
    "es6-promise": "^4.0.3",
    "es6-shim": "^0.35.1",
    "font-awesome": "^4.6.3",
    "jquery": "2.1.4",
    "malihu-custom-scrollbar-plugin": "~3.1.5",
    "material-design-iconic-font": "~2.2.0",
    "moment": "^2.15.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.39",
    "zone.js": "^0.6.25"
  },
  "devDependencies": {        
    "@types/node": "^6.0.45",
    "typescript": "^2.0.6"
  }
}

Here is the tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": true,
    "sourceMap": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "./Scripts/app",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "allowSyntheticDefaultImports": true,
    "jsx": "react",
    "typeRoots": [
      "./node_modules/@types"
    ]            
  },
  "exclude": [

  ],
  "files": [
    "./Scripts/src/main.ts" 
  ],
  "compileOnSave": true
}

Help is appreciated!!!

Upvotes: 3

Views: 469

Answers (1)

Leonardo Lozano
Leonardo Lozano

Reputation: 81

It turned out that I had tsc 1.8. By installing tsc 2.0.x all compiling errors went away. Thanks.

Upvotes: 1

Related Questions