Stav Alfi Stav Alfi - 3 months ago 66
Javascript Question

Angular 2 RC 5 - Can't find Promise

EDIT 19/8/2016:
NOTICE! I removed the question details due to the fact it was related to an older version of angular2.


By installing angular-cli that supports RC5, Promise is not supported.

Please look at @Kris Hollenbeck answer. It is the most up to date answer here.

Answer

UPDATE: USING ANGULAR RC4 WITH TYPESCRIPT 2.0.0

To get this to work with typescript 2.0.0, I did the following.

npm install --save-dev @types/es6-shim

tsconfig.json

 "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "mapRoot": "./",
    "module": "es6",
    "moduleResolution": "node",
    "noEmitOnError": true,
    "noImplicitAny": false,
    "outDir": "../dist/out-tsc",
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [
      "../node_modules/@types"
    ],
    "types": [
      "es6-shim"
    ]
  }

More about @types with typescript 2.0.0.

  1. https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/
  2. https://www.npmjs.com/~types

Note:

This can also be resolved using the core-js library. Whichever is preferred (I prefer core-js). So instead use:

npm install --save-dev @types/core-js

tsconfig.json

  ...
  "types": [
     "core-js"
  ]