Typescript cannot find the name "Promise" despite using ECMAScript 6

I am currently trying to develop a node.js application in Visual Studio 2015 and it continues to tell me

TS2304 Cannot find the name "Promise"

In the project settings, I have ECMAScript 6 configured as a build system, and ES 2015 as a modular system.

I have already tried

  • how to use es6-promises with typescript?

  • How to use Typescript with native ES6 Promises

without success, but in the second link they say that it should work with the ECMAScript version set to 6, but for me nothing changes.

EDIT : now I have done some more diagnostic operations. The problem is that there is a mismatch between the ECMAScript versions used by IntelliSense and the build system.

I discovered this using more ECMAScript 6 features, resulting in the following IntelliSense complaint:

TS1311 Asynchronous functions are only available when configuring ECMAScript 6 or higher.

So, a new question: where to install the version of ECMAScript that IntelliSense uses?

+3
javascript es6-promise visual-studio-2015 typescript
source share
1 answer

This is similar to supervision (I had the same problem). You can easily fix the problem if you install a .d.ts type .d.ts .

If you are using Nuget, just install it from the Package Manager console using:

 PM> Install-Package es6-promise.TypeScript.DefinitelyTyped 
+5
source share

All Articles