Solvedui router typescript compilation errors "Cannot find name 'Promise'"

error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/ng1/directives/viewDirective.d.ts
(8,17): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/ng1/statebuilders/views.d.ts
(40,66): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/state/stateService.d.ts
(74,39): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/transition/transitionHook.d.ts
(15,1919�[31m): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/transition/transitionHook.d.ts
(21,40): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/transition/transitionHook.d.ts
(28,87): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/transition/interface.d.ts
(209,66): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/view/interface.d.ts
(48,13): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/resolve/resolveContext.d.ts
(76,57): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/resolve/resolvable.d.ts
(25,14): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/resolve/resolvable.d.ts
(66,62): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/state/interface.d.ts
(12,44): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/transition/transition.d.ts
(37,14): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/transition/transition.d.ts
(232,12): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/common/common.d.ts
(333,58): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/common/common.d.ts
(333,75): error TS2304: Cannot find name 'Promise'<project_root>/node_modules/angular-ui-router/commonjs/common/common.d.ts

package version 1.0.0-beta.1

19 Answers

✔️Accepted Answer

I recommend using typescript 2.0+ and adding to your tsconfig.json:

{ 
  "compilerOptions": {
    "lib": ["es2015", "dom"]
  }
}

This tells typescript to use the .d.ts files from /node_modules/typescript/lib/lib.<library>.d.ts

Other Answers:

try typings install --global dt~es6-shim

Let me know if it works or not.

@ivanvoznyakovsky Fixed it by installing es6-shim typings

Or just include it in your package.json @types/es6-promise (In typescript 2.x)

npm i --save @types/es6-promise

At file "tsconfig.json" try one of these options:

  • if "target": "es5" add ,
    "lib": [
    "es6"
    ]
  • or change "target": "es5" to "target": "es6"

More Issues: