1

Does anyone have a working example of the quickstart tutorial (https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html) using ES6? Basically, I want to do this:

typings.config (emphasis on es6):

{
"compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
}

}

When I do this and compile, I get duplicate declaration errors in core-js like this:

<path>\typings\globals\core-js\index.d.ts(3,14): error TS2300: Build:Duplicate identifier 'PropertyKey'.

If I remove core-js, I can get it to compile, but it won't work in IE11 (works in Edge, FF and Chrome). If I change it to es5, it works in IE11 as well. I am using the latest version of TypeScript (2.0)

Can someone explain what I am doing wrong? Thanks in advance.

Hari
  • 373
  • 3
  • 11

1 Answers1

1

It looks like the following changes will get the project building without error when targeting es6.

Add the following exclusions to tsconfig.js (core-js is the important one here):

  {
"compilerOptions": {
  "target": "es6",
  "module": "commonjs",
  "moduleResolution": "node",
  "sourceMap": true,
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
  "removeComments": false,
  "noImplicitAny": true,
  "suppressImplicitAnyIndexErrors": true
},
"compileOnSave": true,
"exclude": [
  "node_modules",
  "typings/index.d.ts",
  "typings/globals/core-js"
]

}

Install the jasmine typings to get the specs compiling:

typings install dt~jasmine --global --save

Also the guide doesn't mention copying in systemjs.config.js from the starter project.

JayChase
  • 11,174
  • 2
  • 43
  • 52
  • Thanks for responding Jay. I got it to compile. However, it does not work in IE. I get script errors like this: {description: "(SystemJS) ...", message: "(SystemJS) ...", name: "Error", originalErr: Error {...}, stack: "(SystemJS) ...", Symbol(rxSubscriber)_m.n7ipu3mz39j: undefined} – Hari Sep 28 '16 at 18:22
  • @user3434332 Did you get this to work. I am also facing this issue – sskasim Jan 06 '17 at 16:45
  • Sorry @sskasim, I have not looked into this for a while .. moved on to a different project. I have to return to this at some point. I am hoping that all issues will be gone by then! – Hari Feb 13 '17 at 23:27