1
votes

I have an angular2 application (2.0.0) using typescript (2.0.0). In my tsconfig I compile to es6 with this line:

"target": "es6",

It works fine in Chrome and Edge, but it's not working in IE11.

I changed it to target es5 but then I get several compile errors such as:

ClientApp\app\services\tenant.service.ts(9,16): error TS2304: Cannot find name 'Promise'.
ClientApp\app\components\manage\users.component.ts(70,31): error TS2339: Property 'json' does not exist on type '{}'.

This does produce output and at runtime is seems to work in IE11 and the other browsers (but I have not tested everything). I still don't like the compile errors.

I have core-js included. I thought that was a fix for this issue.

Should I target 5 or 6?

Should es6 work in IE? Is there a shim I'm missing?

How can I use es5 and get rid of the compile errors?

Here is my tsconfig.json:

{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "skipLibCheck": true
  },
  "exclude": [
    "node_modules"
  ]
}
1

1 Answers

0
votes

for the first error I think you should import the TypeScript definition https://github.com/borisyankov/DefinitelyTyped/blob/master/es6-promise/es6-promise.d.ts

For the second one, could you please paste the line code?