安装角之后,打字稿编译器不断收到一些错误约没有找到Promise,Map,Set和Iterator.
到现在为止我忽略了它们,但现在我需要Promise这样我的代码可以工作.
import {Component} from 'angular2/core';
@Component({
selector: 'greeting-cmp',
template: `<div>{{ asyncGreeting | async}}</div>`
})
export class GreetingCmp {
asyncGreeting: Promise<string> = new Promise(resolve => {
// after 1 second, the promise will resolve
window.setTimeout(() => resolve('hello'), 1000);
});
}
Additional information:
npm -v is 2.14.12
node -v is v4.3.1
typescript v is 1.6
Run Code Online (Sandbox Code Playgroud)
错误:
................ERROS OF MY CODE.................
C:\Users\armyTik\Desktop\angular2\greeting_cmp.ts
Error:(7, 20) TS2304: Cannot find name 'Promise'.
Error:(7, 42) TS2304: …Run Code Online (Sandbox Code Playgroud)