创建一个只包含 { }作为内容的 package.json文件(如果您还没有 package.json 的话)。
Call npm install --save @types/es6-promise and tsc --init. The first npm install command will change your package.json to include the es6-promise as a dependency. tsc --init will create a tsconfig.json file for you.
现在可以在打印文件 var x: Promise<any>;中使用这个承诺。
Execute tsc -p . to compile your project. You should have no errors.