angular-cli: (beta.11-webpack) Promise - Corresponding file is not included in tsconfig.json

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) ubuntu 16.04
  2. Versions. Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version and paste the result here:
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.11-webpack
node: 5.11.1
os: linux x64
  1. Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc.
the app was build with angular-cli@beta-10. I followed upgrade instructions and Promises no longer worked, along with styles. 
  1. The log given by the failure. Normally this include a stack trace and some more information.
No errors client side. Just in webstorm.
  1. Mention any other details that might be useful.
ran `npm i @types/es6-promise` and tried adding "es6-promise" to "types":["jasmine"] array and that didn't work. Makes my app unusable.

Thanks! We’ll be in touch soon.

UPDATE Promises still compile and work, but it shows all the errors in webstorm. Not sure if I should just suppress statements with Promise types and .then() statements or not.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (2 by maintainers)

Most upvoted comments

I had this problem in quite a few projects with IntelliJ. Here is how to get rid of it:

  1. Install Typescript 2.X
  2. Go to Preferences > Languages and Frameworks > Typescript.
  • set Typescript version custom, navigate to /usr/local/lib/node_modules/typescript/lib (if you use brew, it’s somewhere else)
  • check “Use Typescript Service (Experimental)”

you’ll have to do this for every project. Good news is, this should use Typescripts own service, meaning this should work for every Typescript version in the future. (Until someone breaks it of course)

screen shot 2016-10-23 at 02 06 47

After doing the same thing over again a few times I managed to get it to work.

npm i @types/es6-promise then added es6-promise to types in tsconfig.json

for some reason those steps didn’t work the first time, now it does.

@EugenIvanou @Codermar @eshell I guess Webstorm is pretty similar to Idea, I am using 2016.2 version and I have installed TypeScript 2.0.2 as global package, then I configure Idea to use that version and not the bundled one.

screen shot 2016-09-11 at 10 52 59

I guess all the issues comes from, as pointed out from @filipesilva, the TypeScript version you use. Idea/Webstorm should even mark some issue in the tsconfig.json about some unrecognized properties.

@filipesilva said that lib properties has to provide Promises definition to compiler, indeed from tsconfig schema

"lib": {
  "description": "Specify library file to be included in the compilation. Requires TypeScript version 2.0 or later.",
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "es5",
      "es6",
      "es2015",
      "es7",
      "es2016",
      "es2017",
      "dom",
      "webworker",
      "scripthost",
      "es2015.core",
      "es2015.collection",
      "es2015.generator",
      "es2015.iterable",
      "es2015.promise",
      "es2015.proxy",
      "es2015.reflect",
      "es2015.symbol",
      "es2015.symbol.wellknown",
      "es2016.array.include",
      "es2017.object",
      "es2017.sharedmemory"
    ]
  }
}

I have just generated a project with angular-cli, I had your same issue that disappeared once TypeScript 2.0.2 has been configured, if I install @types/es6-promise I get duplicate identifier error as @eshell.

My current platform version:

angular-cli: 1.0.0-beta.11-webpack.8
node: 5.4.1
os: darwin x64

Under OS X global packages are installed in /usr/local/lib/node_modules.

Hope it helps 😉

You have to update the version of Typescript used in Webstorm to 2.0.0. Check Webstorm documentation on how to do this.

It worked for me after I’ve checked the “Enable TypeScript Compiler” and “Use tsconfig.json” to the WebStorm/PyCharm 2016.2.3 settings window @blackat added above. My tsconfig.json is:

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

Now i get this after ng build -prod

ERROR in [default] /home/eric/Documents/www/ng2/olweg/node_modules/@types/es6-promise/index.d.ts:11:14 
Duplicate identifier 'Promise'.

ERROR in [default] /home/eric/Documents/www/ng2/olweg/node_modules/@types/es6-promise/index.d.ts:42:18 
Duplicate identifier 'Promise'.

ERROR in [default] /home/eric/Documents/www/ng2/olweg/node_modules/typescript/lib/lib.es2015.iterable.d.ts:121:10 
Duplicate identifier 'Promise'.

ERROR in [default] /home/eric/Documents/www/ng2/olweg/node_modules/typescript/lib/lib.es2015.promise.d.ts:20:10 
Duplicate identifier 'Promise'.

ERROR in [default] /home/eric/Documents/www/ng2/olweg/node_modules/typescript/lib/lib.es2015.promise.d.ts:187:12 
Duplicate identifier 'Promise'.

ERROR in [default] /home/eric/Documents/www/ng2/olweg/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:164:10 
Duplicate identifier 'Promise'.

tsconfig.json

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

It still compiles and works however. It seems to be complaining about declare class Promise and declare namespace Promise is all I can make of it.

@ljieyao Have you tried to remove es6-promise from

"types": [ "jasmine","es6-promise" ]

?