Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webstorm says Promise is an unresolved type

Using WebStorm 10.0

I am currently learning Node Js and installing all of the component it need to work . So i chose to used Jest to test my work, i already installed Jest to my frameworks and languages inside the WebStorm but its keeps showing Promise as unresolved type how do i fix it in WebStorm?

unresolved type

enter image description here

like image 518
menaka Avatar asked Jun 16 '16 13:06

menaka


2 Answers

Promise type is not a part of Jest module; please try enabling 'ECMAScript 6' library for your project in Settings | Languages & Frameworks | JavaScript | Libraries. If it's not available in your version (it is there since WebStorm 11), try downloading typescript stubs for 'promise' library (promise.d.ts)

like image 22
lena Avatar answered Oct 17 '22 21:10

lena


Also, check your tsconfig.json. Either add es6 or es2015.promise to your tsconfig.lib[]

{
  "compilerOptions": {
    ...
    "lib": [
      "es2015.promise"
    ]
  }
}

like image 152
Kyle Phillips Avatar answered Oct 17 '22 21:10

Kyle Phillips