安装角之后,打字稿编译器不断收到一些错误约没有找到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
错误:
................ERROS OF MY CODE.................
C:\Users\armyTik\Desktop\angular2\greeting_cmp.ts
Error:(7, 20) TS2304: Cannot find name 'Promise'.
Error:(7, 42) TS2304: Cannot find name 'Promise'.
.........................................
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\platform\browser.d.ts
Error:(77, 90) TS2304: Cannot find name 'Promise'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\application_ref.d.ts
Error:(83, 60) TS2304: Cannot find name 'Promise'.
Error:(83, 146) TS2304: Cannot find name 'Promise'.
Error:(96, 51) TS2304: Cannot find name 'Promise'.
Error:(96, 147) TS2304: Cannot find name 'Promise'.
Error:(133, 90) TS2304: Cannot find name 'Promise'.
Error:(171, 81) TS2304: Cannot find name 'Promise'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\change_detection\parser\locals.d.ts
Error:(3, 14) TS2304: Cannot find name 'Map'.
Error:(4, 42) TS2304: Cannot find name 'Map'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\debug\debug_node.d.ts
Error:(14, 13) TS2304: Cannot find name 'Map'.
Error:(24, 17) TS2304: Cannot find name 'Map'.
Error:(25, 17) TS2304: Cannot find name 'Map'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\di\provider.d.ts
Error:(436, 103) TS2304: Cannot find name 'Map'.
Error:(436, 135) TS2304: Cannot find name 'Map'.
慕容3067478
一只甜甜圈
相关分类